Skip to content
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

Sphinx autodoc fails to reference objects through intersphinx #10468

Open
Dreamsorcerer opened this issue Feb 19, 2025 · 2 comments
Open

Sphinx autodoc fails to reference objects through intersphinx #10468

Dreamsorcerer opened this issue Feb 19, 2025 · 2 comments
Labels
bug documentation Improvements or additions to documentation good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/

Comments

@Dreamsorcerer
Copy link
Member

As we don't seem to use autodoc anywhere, it seems we've missed this issue.

When using autodoc in a project, it will inspect the fully resolved name of an object, for example aiohttp.client.ClientSession. As the submodules are implementation details and we don't want to expose them to users, we only have aiohttp.ClientSession etc. in our docs.

To fix this, we should be able to use the :canonical: directive to create aliases that intersphinx can use for references. The end result should still not display the submodules to users reading the docs, but will allow intersphinx linking via the submodules.
https://www.sphinx-doc.org/en/master/usage/domains/python.html#directive-option-py-method-canonical

This probably needs to be done for almost all object in the reference docs.

@Dreamsorcerer Dreamsorcerer added bug documentation Improvements or additions to documentation good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/ labels Feb 19, 2025
@webknjaz webknjaz moved this to 🦉 Inclusion ⚖️ in 📅 Procrastinating in public Feb 19, 2025
@MohsenHNSJ
Copy link

I have encountered this issue, and i found that autoapi does work with the current status of documentation.

The exact error from autodoc is the following:

WARNING: py:class reference target not found: aiohttp.client.ClientSession [ref.class]

@webknjaz
Copy link
Member

@MohsenHNSJ technically, the error isn't from autodoc. Autodoc just generates RST files. It uses reference names it sees in runtime. But then you invoke sphinx-build which attempts to look up objects with those names and can't find any because our Sphinx docs only documents the aliased refs without their canonical addresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation Improvements or additions to documentation good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

No branches or pull requests

3 participants