Skip to content

Intersphinx cross-referencing does not work naively #428

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

Closed
leofang opened this issue May 10, 2022 · 8 comments · Fixed by #430
Closed

Intersphinx cross-referencing does not work naively #428

leofang opened this issue May 10, 2022 · 8 comments · Fixed by #430
Labels
Document Formatting Document formatting or styling. Maintenance Bug fix, typo fix, or general maintenance.
Milestone

Comments

@leofang
Copy link
Contributor

leofang commented May 10, 2022

I am improving CuPy's documentation and hit this issue...

Let's say I want to reference arange from the array API. Ideally, I would expect this should work out of box:

# conf.py
# ...
intersphinx_mapping = {
    ...
    'array_api': ('https://data-apis.org/array-api/2021.12/', None),
    ...
}
# ...

and in anywhere (rst files or docstrings) I could just do

:func:`array_api.arange`

to link to arange. Unfortunately, this does not work, nor does the global version (removing the array_api prefix). Instead I must do this following due to this repo's structure:

:func:`signatures.creation_functions.arange`

This is quite confusing and counter-intuitive. I could work with it, but I am wondering if we could do better, say re-organizing the Python stub files such that array_api.arange works, so opening this issue to collect feedbacks and suggestions.

@leofang leofang added Document Formatting Document formatting or styling. Maintenance Bug fix, typo fix, or general maintenance. labels May 10, 2022
@kgryte
Copy link
Contributor

kgryte commented May 10, 2022

cc @steff456

@rgommers
Copy link
Member

We should fix this, the signatures part should be removed.

@steff456
Copy link
Member

I've been trying to fix this issue without major luck. I'll give it another check to see if I can remove the signatures and also shorten the amount of writing in a cross reference.

@steff456 steff456 self-assigned this May 10, 2022
@asmeurer
Copy link
Member

Why don't we just rename signatures to array_api?

@leofang
Copy link
Contributor Author

leofang commented May 10, 2022

Also in __init__.py we need to import all functions to provide a flat namespace (except for the extension modules).

@leofang
Copy link
Contributor Author

leofang commented May 23, 2022

@kgryte Is there a way we can "backport" the fix #430 to v2021? It only fixed the draft version but not the latest (or 2021.12) version. Try comparing the outputs and you'll see:

python -m sphinx.ext.intersphinx https://data-apis.org/array-api/draft/objects.inv
python -m sphinx.ext.intersphinx https://data-apis.org/array-api/latest/objects.inv
python -m sphinx.ext.intersphinx https://data-apis.org/array-api/2021.12/objects.inv

@leofang leofang reopened this May 23, 2022
@leofang leofang added this to the v2021 milestone May 23, 2022
@kgryte
Copy link
Contributor

kgryte commented May 23, 2022

@leofang Yes, this should be possible. Will see what I can do.

@rgommers
Copy link
Member

rgommers commented Mar 9, 2023

I believe this was fixed, the intersphinx content seems consistent across all versions and signatures isn't present:

% python -m sphinx.ext.intersphinx https://data-apis.org/array-api/2022.12/objects.inv | rg arange
	array_api.arange                         API_specification/generated/array_api.arange.html#array_api.arange
	API_specification/generated/array_api.arange arange                                  : API_specification/generated/array_api.arange.html

% python -m sphinx.ext.intersphinx https://data-apis.org/array-api/2021.12/objects.inv | rg arange
	array_api.arange                         API_specification/generated/array_api.arange.html#array_api.arange
	API_specification/generated/array_api.arange arange                                  : API_specification/generated/array_api.arange.html

% python -m sphinx.ext.intersphinx https://data-apis.org/array-api/latest/objects.inv | rg arange
	array_api.arange                         API_specification/generated/array_api.arange.html#array_api.arange
	API_specification/generated/array_api.arange arange                                  : API_specification/generated/array_api.arange.html

% python -m sphinx.ext.intersphinx https://data-apis.org/array-api/draft/objects.inv | rg arange
	array_api.arange                         API_specification/generated/array_api.arange.html#array_api.arange
	API_specification/generated/array_api.arange arange                                  : API_specification/generated/array_api.arange.html

So I'll close this - thanks all!

@rgommers rgommers closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Document Formatting Document formatting or styling. Maintenance Bug fix, typo fix, or general maintenance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants