Skip to content

Avoid importing new modules in backrefs#1177

Merged
larsoner merged 3 commits intosphinx-gallery:masterfrom
aganders3:safer-backrefs
Sep 20, 2023
Merged

Avoid importing new modules in backrefs#1177
larsoner merged 3 commits intosphinx-gallery:masterfrom
aganders3:safer-backrefs

Conversation

@aganders3
Copy link
Copy Markdown
Contributor

This fixes #1158 (or, is intended to help at least) based on the proposed solution in that issue and discussion elsewhere.

Hopefully this solution makes sense but I'm happy to rework as I came up with a lot of ways to do effectively the same thing. I am not too intimately familiar with the import system (at least I was not when I started on this) and definitely a little lost in some of this sphinx-gallery code.

Either way I know @lucyleeow had also suggested this should possibly be a config and I am happy to add that if you want it. I will also read though to see if there's a good spot to put some of this info in the docs.

It's also worth noting that now setuptools 68.1.0 has been released, which should fix the specific problem (case-insensitive imports from editable installs) that brought this issue to light for me.

@larsoner
Copy link
Copy Markdown
Contributor

I think in principle we shouldn't need a config option for this. I'd rather try using it globally and if we find problems with it fix them (maybe by use of a config var but hopefully not)

Copy link
Copy Markdown
Contributor

@lucyleeow lucyleeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits but looks good otherwise!

@lucyleeow lucyleeow added the bug label Aug 18, 2023
@lucyleeow
Copy link
Copy Markdown
Contributor

@larsoner will merge this soon unless you want another look?

@larsoner larsoner merged commit c3a6684 into sphinx-gallery:master Sep 20, 2023
@larsoner
Copy link
Copy Markdown
Contributor

Thanks @aganders3 !

@aganders3 aganders3 deleted the safer-backrefs branch September 20, 2023 14:31
@aganders3
Copy link
Copy Markdown
Contributor Author

Thanks @aganders3 !

Thanks! Let me know if you hear of users having issues with this; I'm happy to look into them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Searching for short module names in backreferences has side effects

3 participants