Skip to content

Conversation

@abravalheri
Copy link
Contributor

@abravalheri abravalheri commented Mar 21, 2025

I was trying to right some documentation for setuptools that reference a couple of new fields in the pyproject.toml PyPUG document using intersphinx.

Initially I tried to use a fragment in the :doc: role like the following:

:doc:`project.license <PyPUG:specifications/pyproject-toml/#license-files>`
:doc:`project.license <PyPUG:specifications/pyproject-toml/#license>`

But it seems that Sphinx doesn't know how to handle fragments (If I remove the fragment everything is fine):

/home/runner/work/setuptools/setuptools/docs/userguide/pyproject_config.rst:74: WARNING: unknown document: 'PyPUG:pecifications/pyproject-toml/#license-files' [ref.doc]
/home/runner/work/setuptools/setuptools/docs/userguide/pyproject_config.rst:74: WARNING: unknown document: 'PyPUG:pecifications/pyproject-toml/#license' [ref.doc]

This means that in order link to an individual field in the PyPUG document, it would be necessary to add reference anchors in the PyPUG rst file first.

This is what this PR is trying to achieve.

When the references are in place, than I could use something like the following:

:external+PyPUG:ref:`project.license <pyproject-toml-license>

📚 Documentation preview 📚: https://python-packaging-user-guide--1832.org.readthedocs.build/en/1832/

@abravalheri abravalheri marked this pull request as ready for review March 21, 2025 13:15
@webknjaz
Copy link
Member

Initially I tried to use a fragment in the :doc: role like the following:

The :doc: role is for documents, as in entire web pages. Declaring refs would work. I have a little helper for myself where you can see what objects are linkable: https://webknjaz.github.io/intersphinx-untangled/packaging.python.org/.

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

thanks!

@webknjaz webknjaz added this pull request to the merge queue Mar 21, 2025
Merged via the queue into pypa:main with commit 99469d7 Mar 21, 2025
8 checks passed
@abravalheri abravalheri deleted the add-references-pyproject.toml branch March 21, 2025 13:48
@abravalheri
Copy link
Contributor Author

Thank you very much @webknjaz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants