Skip to content

DOC: fix nitpicky Sphinx warnings in NEP 13#31377

Open
rio767 wants to merge 3 commits into
numpy:mainfrom
rio767:fix-nep13-docs
Open

DOC: fix nitpicky Sphinx warnings in NEP 13#31377
rio767 wants to merge 3 commits into
numpy:mainfrom
rio767:fix-nep13-docs

Conversation

@rio767
Copy link
Copy Markdown

@rio767 rio767 commented May 3, 2026

PR summary

Fix unresolved Sphinx references in NEP 13.

This PR replaces :func: roles that cannot be resolved in the NEP
documentation build with inline literals (func), preventing warnings
when building NEPs with nitpicky mode (-n -W).

This reduces warnings in NEP 13 without changing content or meaning.

Remaining warnings in the NEP build are related to toctree structure and
are outside the scope of this PR.

First time committer introduction

Hi, I’m a first-time contributor to NumPy.
I’m a computer science student and have been using NumPy in my academic work and projects. While exploring the repository and documentation, I wanted to contribute by improving documentation quality.
This issue stood out as a good opportunity to understand the documentation build system and Sphinx behavior, so I worked on fixing the unresolved references in NEP 13.

AI Disclosure

AI was only used for guidance in understanding Sphinx warnings and debugging reference resolution issues.
The final code changes (replacement of unresolved :func: roles with inline literals) were reviewed and applied manually, and no AI-generated code was directly used. .

Comment thread doc/neps/nep-0013-ufunc-overrides.rst Outdated

Subclasses can be easily constructed if methods consistently use
:func:`super` to pass through the class hierarchy [7]_. To support
:func:``super`` to pass through the class hierarchy [7]_. To support
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These should work. They uses the intersphinx protocol to link to the python documentation. It would be better to find out why :func: is not working than to reformat all these to code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion!

I restored :func: roles where intersphinx resolves correctly.
For cases like numpy.matmul that do not resolve, I used inline
literals to avoid broken references. The NEP now builds cleanly without introducing new warnings.

====== ============ =========================================
Symbol Operator NumPy Ufunc(s)
====== ============ =========================================
``<`` ``lt`` :func:`less`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These should render properly. I wonder what is off. Maybe you need something like this neare the top of the file?

.. currentmodule:: numpy

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The file already includes .. currentmodule:: numpy at the top, so
:func: roles should resolve via intersphinx. However, in this section
(particularly inside the table), references like :func:less`` were not
resolving and were causing nitpicky (-n -W) build failures.

To verify, I tested:

  • Keeping :func: → still produced unresolved reference warnings
  • Adding .. currentmodule:: numpy again → no change
  • Using fully-qualified :func:numpy.less`` → works, but is more verbose
  • Using inline literals (less) → removes warnings and keeps the table readable

Given that, I switched the problematic entries to inline literals to
avoid broken references while keeping the content unchanged.

Could you clarify what specific rendering or linking you’d prefer here?
I’m happy to adjust

if this si the expected style i could switch to fully-qualified :func:~numpy.less``

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be nice to see the links work, I think. So if the last works lets go with that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

hey @mattip I updated all ufunc references to fully-qualified links (e.g. :func:~numpy.matmul),
and verified that they now resolve correctly without reference warnings.

The remaining warnings appear to be unrelated to this file (toctree / NEP indexing).
Please let me know if you'd like me to adjust anything further.

@mattip
Copy link
Copy Markdown
Member

mattip commented May 6, 2026

There are still lots of warnings. Try to build the docs locally:

# setup venv and install requirements/doc_requirements, requirements/build_requirements
spin install
cd doc/neps
SPHINXOPTS="-n" make -e html

@rio767
Copy link
Copy Markdown
Author

rio767 commented May 7, 2026

There are still lots of warnings. Try to build the docs locally:

# setup venv and install requirements/doc_requirements, requirements/build_requirements
spin install
cd doc/neps
SPHINXOPTS="-n" make -e html

he @mattip i re-ran the NEP docs build in my local setup after the latest changes.

The unresolved NEP 13 cross-reference warnings related to the NumPy function links (numpy.add, numpy.matmul, etc.) are already fixed by switching them to intersphinx-compatible references. The build no longer reports the previous py:func reference target not found warnings from nep-0013-ufunc-overrides.rst.

The remaining warnings are existing repository-wide NEP warnings such as:

  • toc.not_readable
  • toc.not_included
  • duplicate toctree references

These are not coming from the NEP 13 changes themselves and still appear when building the full NEP docs locally.

still to be sure as told by i set up a fresh virtual environment, installed both requirements/doc_requirements.txt and requirements/build_requirements.txt, initialized the submodules, and rebuilt the docs locally using:

python -m sphinx -n -W -b html . _build/html
and i saw no warnings related to nep 13

Since the original issue scope was fixing the NEP 13 rendering/reference issues, could you confirm whether this is now in the expected state, or whether you’d also like me to work on the broader NEP toctree warnings separately

@rio767 rio767 closed this May 7, 2026
@rio767 rio767 reopened this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants