chore: add link-checking command #551
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Reading through the packaging guide, as part of working on pyOpenSci/pyosPackage#56, I noticed that there are a lot of links to external resources in the packaging guide.
Enough that I think it'd be worth adding some automation to check the validity of those links.
@agriyakhetarpal recently taught me (in jameslamb/pydistcheck#293 (comment)) about 2 forms of this that are really useful and do complementary things:
sphinx -b linkcheck
: check links in Sphinx docs (docs on how to do this)lychee
: check all other links in the project (docs on how to do this)This PR proposes introducing a
nox
session that can be used to run the Sphinx link checks. As of this PR, running this from the root of the repo:Generates a summary like this:
46 remaining broken or redirecting URLs (click me)
It also fixes a few link issues that were caught by this:
hatch
has moved to thepypa
GitHub orgsetuptools-scm
is now spelled with a-
not a_
These were all successfully redirecting today, but using the direct targets will make page loads a little faster and reduce the risk of those links being broken if those redirections are eventually removed in the future.
Notes for Reviewers
Thanks for your time and consideration. If this is annoying please close it and sorry for the noise.
Why not fix all the links?
I just didn't want this to be too large, especially since I'm new to this project.
If maintainers are receptive to it, I'd be happy to create an issue documenting the remaining broken links, so folks can contribute fixes for them.
Why not also add
lychee
?Again just trying to keep this small and focused. If maintainers are receptive, I'd be happy to put up a follow-up PR proposing adding that. Here's what it can look like: jameslamb/pydistcheck#312
Should this run in CI?
It would be helpful, but you might find that link checks break so often that they're disruptive to have in CI that runs on every commit to every PR. In my experience, for every 1 "this was permanently deleted" type of error, you'll experience like 25 of the form "temporary network disruption", "server down for maintenance", etc.
A once-a-week scheduled job and a README badge making the status visible is probably enough. Up to yall though, that's definitely bigger than this PR and depends on your interest. I'd be happy to create an issue or follow-up PR if you'd like.
How I tested this