Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Originally found this when trying to document the class
mne.Dipolewhen there is also themne.dipolemodule. Sphinx would try to importmne.Dipolefirst, which could succeed on a case-insensitive filesystem (and was observed on Windows) but errantly importmne.dipole(so all the class attributes etc. were missing). This PR changes the order: look for a (case-sensitive)sys.modulesexistence (for intermediate components), then an attributegetattr(mne, "Dipole"), and then try an import.This PR mocks the case-insensitive import behavior via a
sys.meta_pathfinder so it's reproducible on all platforms and more easily tested. It also does a combined test withautosummary_filename_map, which helps with a similar problem. Two tests are red onmasterbut pass on this PR, and the third (test_import_by_name_attribute_shadows_module) is there to make sure an existing case onmaster(a function shadowing its own module likefrom .util import util) isn't broken.References
Closes #11362 (mine -- 3+ years ago, now I could finally look into it more deeply!)
AI Disclosure
Claude Fable 5 was used to write the implementation, tests, and changelog entry. I reviewed and validated the implementation (e.g., suggesting a combined test to hit the
autosummary_filename_mappath as well).