Open larsoner opened 1 year ago
The way autosummary is importing objects is using
Try to look inside the codesource directly
putting print
here and there (I'm on Linux so it's kind of hard to reproduce the issue). First, it'd be good to know where the ValueError occurs because it's a bit weird. Also, it'd be good to know the original real target name that was tried.
What I understood:
If you can tell me in the exact order of what was imported (and also why there was a ValueError), I can think of a workaround. By the way, the reason why autosummary_filename_map
does not work is because it is used after the items are imported, so it will never be considered. The only idea I have is to actually bypass the import system and make it so that everything is imported in a case-sensitive way but 1) I don't have any testing environment 2) it might still be fragile
1) I don't have any testing environment
FWIW nowadays you can get a Windows VM running for testing stuff. It would probably take ~1h to set it up with Python and everything, but it's at least doable if you're interested!
2) it might still be fragile
Indeed in thinking about the issue it's hard to see a solution that wouldn't be fragile given Python's own behavior of import mne.Dipole
creating a mne.Dipole
module :(
I'll try to look again on my Windows boot at some point but probably won't get to it for a bit.
Describe the bug
We have
mne/dipole.py
in which there is aDipole
class defined. We import this class (and.dipole
) inmne/__init__.py
, and document withautosummary
/autodoc
themne.Dipole
class in the root namespace. On Windows (case-insensitive), we have the following problem, which just started show up on April 17th-ish in our builds:mne.Dipole.crop
is a valid method and is documented properly on Linux. I think it's driven by the following behavior on Windows -- namely, that if you tryimport mne.Dipole
Python importsmne/dipole.py
module asmne.Dipole
:I think
autosummary
is doing some module importing under the hood here that is having this effect. I'm not sure if it's possible to directly trymne.dipole.Dipole
ormne.Dipole
before trying toimport mne.Dipole
, as that would fix the problem...?How to Reproduce
I can try to come up with a MWE if it's not obvious that there is some existing workaround or what the problem is. I'm not sure it will be easy, though, as which errors we get for which classes appears to change run-to-run :(
Environment Information
Sphinx extensions
Additional context
mne.Dipole
atmne.dipole.Dipole
in the docs instead, but we really want this (and other classes with the same problem) in the root namespace. We also wantmne.dipole
to be public because some dipole-related functions live there and shouldn't live in the rootmne
namespace.