-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference target not found due to import aliases #10198
Comments
@tk0miya any thoughts on this? I finally convinced PyTorch/torchvision to upgrade from Sphinx 3 to 5 in hopes of fixing these kinds of import alias issues but I'm finding that this didn't actually change anything. See microsoft/torchgeo#637 for the PR where I try to remove the hacks I added to |
Is there a more minimal reproducer than the entire TorchGeo documentation? A |
@AA-Turner here is the smallest possible minimal reproducer I can come up with.
You should be able to reproduce this with any class or function that uses import aliases. In the case of PyTorch, the from .module import Module and from .modules import * This results in the Let me know if you want a minimal reproducer that doesn't rely on an external library (PyTorch is also massive). It should be possible to see the same problem within a single library as long as you use import aliases. |
Indeed, the objects.inv of pytorch does not contain
It seems they're using Sphinx-5.0. So it's strange to me. We need to investigate why it does not contain the canonical name of the class... |
It's very helpful. Could you make it if you have time? |
I'm having trouble reproducing this with only a single repo. I think it will require at least 2 repos. The originally issue I reported in the first comment of this issue ( |
My intuition would be that they're closely related, so for now lets just keep this one issue. If we find out that there are two entirely different causes, we can split later. A |
Found a workaround for this. Simply replace: #: adds on to other :attr:`thing` with: #: adds on to other :attr:`~Foo.thing` I'm satisfied with this workaround, so I think we can close this. Thanks for the help! |
Describe the bug
See #9395 for context. In #9395 we determined that hacking
__module__
attributes of classes isn't necessary when using Sphinx 4. I tried removing our hacks in microsoft/torchgeo#401 but now I'm encountering a build issue: https://readthedocs.org/projects/torchgeo/builds/16098659/Basically, source code looks like:
The error message Sphinx gives is:
Oddly enough, it seems to locate one of the other attributes without any issues.
How to Reproduce
You should see a build error like:
Expected behavior
I would expect this to work without having to hack
__module__
since I'm using Sphinx 4.Your project
https://readthedocs.org/projects/torchgeo
Screenshots
No response
OS
Linux
Python version
3.7
Sphinx version
4.4.0
Sphinx extensions
sphinx.ext.autodoc
Extra tools
No response
Additional context
Follow-up to discussion in #9395 @tk0miya
The text was updated successfully, but these errors were encountered: