-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Re-integrate Sphinx's linkcheck into CI configuration #12932
base: main
Are you sure you want to change the base?
Re-integrate Sphinx's linkcheck into CI configuration #12932
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR ! I have some suggestions, I think the dead code comments should be removed before merging too. Also what makes the sphinx upgrade mandatory ?
doc/en/conf.py
Outdated
r"https://github\.com/sponsors/.*", | ||
r"https://pypi\.org/project/pytest.*", | ||
r"https://github\.com/pytest-dev/pytest/issues/.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes in theory the dot should be escaped in a regex, as it's not a dot, it's "any character", but it works and is simpler imo. (like in the two links above). Or we can make the two links above consistent :)
r"https://github\.com/sponsors/.*", | |
r"https://pypi\.org/project/pytest.*", | |
r"https://github\.com/pytest-dev/pytest/issues/.*", | |
r"https://github.com/sponsors/.*", | |
r"https://pypi.org/project/pytest.*", |
I think we should modify the existing regex line 144 /145 so they accept link to a comment, or remove them entirely in favor of the simpler one you added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified it to:
linkcheck_ignore = [
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/",
"http://pythontesting.net/framework/pytest-introduction/",
r"https://pypi\.org/project/pytest.*",
r"https://github\.com/sponsors/.*",
r"https://github\.com/pytest-dev/pytest/issues/.*",
r"https://github\.com/pytest-dev/pytest/pull/.*",
]
… into chvastas/bring-back-link-checks
I deleted commented line in code. The update of Sphinx from version 7 to version 8.1.3 was due to better configuration and performance Improvements in the new version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Thank you for the PR, the changes look good.
I would expect some links to have to be fixed, isn't there any to fix ? (There was a list of broken link in the original issue.) Also reading the issue I understood that it should be something periodical and automated like pre-commit or dependabot but I'm not sure who this is addressed here.
r"https://github.com/pytest-dev/pytest/issues/\d+", | ||
r"https://github.com/pytest-dev/pytest/pull/\d+", | ||
r"https://pypi\.org/project/pytest.*", | ||
r"https://github\.com/sponsors/.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? I don't remember such URLs not working in other projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r"https://github.com/pytest-dev/pytest/issues/\d+",
r"https://github.com/pytest-dev/pytest/pull/\d+",
this is from the original version. But you're right, this doesn't trigger any issues with link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without r"https://github\.com/sponsors/.*",
checking will trigger issues:
WARNING: broken link: https://github.com/sponsors/xxx (429 Client Error: Too Many Requests for url: https://github.com/xxx)
It seems to be related to missing credentials or tokens for GitHub but I'm not 100% sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With xxx
specifically, I suppose? How about with real existing usernames?
@@ -141,10 +141,18 @@ | |||
linkcheck_ignore = [ | |||
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/", | |||
"http://pythontesting.net/framework/pytest-introduction/", | |||
r"https://github.com/pytest-dev/pytest/issues/\d+", | |||
r"https://github.com/pytest-dev/pytest/pull/\d+", | |||
r"https://pypi\.org/project/pytest.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches any project page starting with pytest
. Like pytesty
. Why? I don't think I've seen any problems with this host in linkcheck in the past.
r"https://github.com/pytest-dev/pytest/pull/\d+", | ||
r"https://pypi\.org/project/pytest.*", | ||
r"https://github\.com/sponsors/.*", | ||
r"https://github\.com/pytest-dev/pytest/issues/.*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be more accurate. Such a wildcard would also silence obviously broken URLs like https://github.com/pytest-dev/pytest/pull/zombie that should produce errors otherwise.
doc/en/requirements.txt
Outdated
@@ -2,7 +2,8 @@ | |||
pluggy>=1.5.0 | |||
pygments-pytest>=2.3.0 | |||
sphinx-removed-in>=0.2.0 | |||
sphinx>=7 | |||
sphinx>=8.1.3 | |||
sphinx_issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sphinx-issues
is already listed below
sphinx_issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed
tox.ini
Outdated
deps = | ||
-r{toxinidir}/doc/en/requirements.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you keep such formatting changes out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIxed
@@ -143,7 +144,7 @@ passenv = | |||
deps = | |||
PyYAML | |||
regendoc>=0.8.1 | |||
sphinx | |||
sphinx>=8.1.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should instead just reference the requirements file or the base section value...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking time to look into the issue. It looks like this PR mass-ignores a lot of URLs that should instead be validated.
Instead, we should make every ignore regex very precise so we don't suppress too many things and hide problems in doing so.
Additionally, I'd like to ask you to add code comments justifying every single ignore entry you're adding or changing. Here's an example: https://github.com/cherrypy/cheroot/blob/a9c1fe4/docs/conf.py#L124-L125. So far, it looks like some of those are not justified and shouldn't be there, but it's hard to be sure because the explanation is mysteriously missing.
This can't be run in pre-commit or dependabot. Instead, it should be integrated into GHA. @ladislav987 it's necessary to add a separate GHA workflow with a job calling |
… into chvastas/bring-back-link-checks
linkcheck_workers = 20 | ||
linkcheck_timeout = 30 | ||
linkcheck_retries = 2 | ||
linkcheck_anchors = False | ||
linkcheck_rate_limit_timeout = 2.0 | ||
linkcheck_delay = 2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the defaults of these?
Bring Back Link Checks for Documentation (#12474)
Description:
This pull request addresses the need to re-enable link checks as detailed in issue #12474. The following changes were implemented:
Adjusted linkcheck_workers from 5 to 20 to improve check efficiency.
Added parameters to enhance link check stability:
Added commented-out code (optional) to exclude specific directories to avoid check interruptions:
Without r"https://github\.com/sponsors/.*", I get lot "Too Many Requests for url". It seems to be related to missing credentials or tokens for GitHub.
Modified the Sphinx build command in tox.ini:
Added commented-out (optional) code to facilitate output logging if needed: