Skip to content

Conversation

@FFY00
Copy link
Member

@FFY00 FFY00 commented Nov 12, 2025

This PR restores the linkcheck functionality for https://packaging.python.org/en/latest/... links.

It does so by adding a Sphinx plugin that hooks into the linkcheck-process-uri event and replaces the original URLs with the corresponding local path.

We've had a couple issues with schema links, which need to be specified via the full remote URL (eg. #1889 (comment)). We currently need to ignore them in linkcheck as it fails to take into account local changes. With this PR, the ability to catch these issues during lint is restored.


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

Signed-off-by: Filipe Laíns <lains@riseup.net>
@FFY00 FFY00 requested a review from ncoghlan November 12, 2025 14:23
@FFY00 FFY00 mentioned this pull request Nov 12, 2025
@webknjaz
Copy link
Member

Wow, that's a nice idea. Might be useful as an external project too. Though, it looks like the linkcheck job is failing due to this?

@FFY00
Copy link
Member Author

FFY00 commented Nov 14, 2025

Looks like it's failing because linkcheck cannot resolve relative links to html_extra_path. That's something that could be added to the plugin.

Signed-off-by: Filipe Laíns <lains@riseup.net>
@FFY00 FFY00 requested a review from webknjaz November 14, 2025 22:50
@FFY00
Copy link
Member Author

FFY00 commented Nov 14, 2025

CI is passing now 😊

>>> resolve_local_html_link('https://packaging.python.org/en/latest/specifications/schemas/')
'{srcdir}/specifications/schemas/index.rst'
>>> resolve_local_html_link('https://packaging.python.org/en/latest/specifications/schemas/build-details-v1.0.schema.json')
'{html_extra_path0}/specifications/schemas/build-details-v1.0.schema.json'
Copy link
Contributor

Choose a reason for hiding this comment

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

typo?

Suggested change
'{html_extra_path0}/specifications/schemas/build-details-v1.0.schema.json'
'{html_extra_path}/specifications/schemas/build-details-v1.0.schema.json'

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.

3 participants