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

Docs: Intersphinx references require fully qualified name for 2.0 documentation #5518

Closed
janssenhenning opened this issue May 5, 2022 · 5 comments · Fixed by #5657
Closed

Comments

@janssenhenning
Copy link
Contributor

Describe the current issue

Starting with version 2.0 it is no longer possible to use interpshinx references like :py:class:`aiida.orm.Dict` in external documentations. aiida-fleur has intersphinx set up like this

intersphinx_mapping = {
    'aiida': ('https://aiida-core.readthedocs.io/en/latest/', None),
}

Which prior to 2.0 generated a link like this https://aiida.readthedocs.io/projects/aiida-core/en/latest/reference/apidoc/aiida.orm.html#aiida.orm.Dict for the above reference (To see that it still works replace latest with v1.6.8 like here). With 2.0 the reference can no longer be resolved leading to errors like in this CI job

Describe the solution you'd like

Of course these references can be replaced with the fully qualified name :py:class:`aiida.orm.nodes.data.dict.Dict` , but this seems quite fragile since aiida-core relies on the exporting in __init__.py files a lot. Replacing the intersphinx link with the v1.6.8 documentation is a fix but this would only be a temporary solution

@ltalirz
Copy link
Member

ltalirz commented May 9, 2022

Thanks for reporting @janssenhenning, I noticed this in the AiiDA plugin cutter as well.

Do we know what changed here? @sphuber

@chrisjsewell
Copy link
Member

Yep I changed it in 58a5d80, because it was (silently) broken before.
Basically, you can have autodoc for __all__ imports or for absolute imports, but you can't have both.

@chrisjsewell
Copy link
Member

We can switch over to only documenting via __all__, which I'd prefer, but it will likely take a bit of work

@ltalirz
Copy link
Member

ltalirz commented May 9, 2022

From the commit message

Then, to overcome the fact that we would still like to refer to the top-level module paths
(e.g. aiida.orm.Computer rather than aiida.orm.computers.Computer),
some code has been added in conf.py, to specify these aliases.

I just think that this is an important feature for plugin authors as well.

I guess a temporary fix can be to specify those aliases in the plugin's conf.py as well (we could also do this in the plugin cutter) but this is not a long term solution as they will inevitably go out of sync.

Edit: If we make the aliases importable from the plugin side, that's already better.

@ltalirz
Copy link
Member

ltalirz commented Jun 15, 2022

I've run into this issue again.

I will open a PR to move the AutodocAliases class inside aiida-core such that plugins can import them as well in their documentation.

sphuber added a commit to aiidateam/aiida-tutorials that referenced this issue Aug 29, 2022
These references raise the warning:

    WARNING: py:meth reference target not found:

This is a problem with inter-sphinx that likely has to do with the issue
on `aiida-core`: aiidateam/aiida-core#5518.

As a temporary fix, we remove references until the underlying problem
has been properly resolved.
sphuber added a commit to aiidateam/aiida-tutorials that referenced this issue Aug 29, 2022
These references raise the warning:

    WARNING: py:meth reference target not found:

This is a problem with inter-sphinx that likely has to do with the issue
on `aiida-core`: aiidateam/aiida-core#5518.

As a temporary fix, we remove references until the underlying problem
has been properly resolved.
@chrisjsewell chrisjsewell linked a pull request Sep 22, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants