FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Linkcheck for newly add links in PRs · Issue #2037 · pypa/packaging.python.org · GitHub

Repository navigation

Linkcheck for newly add links in PRs #2037

Description

Issue Description

As follow-up to #2035 (review), we should change the linkcheck setup so that it check for new links in PRs, so that PR reviewers know that all newly added links are valid.

Code of Conduct

  • I am aware that participants in this repository must follow the PSF Code of Conduct.

Activity

  1. webknjaz commented on May 4, 2026

    Member

    Copy of context @ #2035 (comment)

    I'm not aware of any tool or function that would support only blocking on new URLs, but we can add it separately. This PR is about not blocking working PRs on a broken linkcheck, including things such as getting changes from accepted PEPs linkcheck.

    So linkcheck produces JSONL like this: ansible/awx-plugins/actions/runs/24041509767#summary-70114297278. If we have that pre-downloaded into the job from artifacts/cache, we could have docs/conf.py read it and extract all the known URLs.

    Then, linkcheck_ignore could be populated with all those known URLs either right on the module level or from within the setup() function, but only in the context of PRs (and merge queues). This way, the PR runs would exclude checks against everything that used to be known prior to the PR merge, and new things would still be checked.


    Copy of context @ #2035 (comment)

    [..] I wanted to see where these reports are ending up now, in the current integration.

    I've found they are in the build dir:

    $ nox -s linkcheck
    nox > Running session linkcheck
    nox > Creating virtual environment (virtualenv) using python in .nox/linkcheck
    nox > python -m pip install -r requirements.txt
    nox > sphinx-build -b linkcheck -d .nox/.cache/.doctrees --color -n -W --keep-going source build
    Running Sphinx v7.2.6
    loading pickled environment... done
    [...]
    ^C
    Interrupted!
    nox > Interrupted...
    nox > Session linkcheck interrupted.
    $ ls -l build/output.txt build/output.json
    -rw-r--r-- 1 <username> <username> 161031 May  1 09:22 build/output.json
    -rw-r--r-- 1 <username> <username>  14242 May  1 09:22 build/output.txt
    

    There's an untested sketch for starters:

    $ git diff source/conf.py
    diff --git a/source/conf.py b/source/conf.py
    index 22b0e5e3..cdb3fe7c 100644
    --- a/source/conf.py
    +++ b/source/conf.py
    @@ -182,6 +182,12 @@ if _gh_token := os.getenv("GITHUB_TOKEN"):
             "https://api.github.com/": {"Authorization": f"Bearer {_gh_token}"},
         }
     
    +    if os.getenv("GITHUB_ACTIONS") == "true":
    +        output_dir = pathlib.Path("build/")
    +        output_jsonl_file = output_dir / "output.json"
    +        for json_object in output_jsonl_file.read_text().splitlines():
    +            linkcheck_ignore.append(json_object["uri"])  # FIXME: escape the regex
    +
     # -- Options for extlinks ----------------------------------------------------------
     # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html#configuration

    Of course, this needs to be brushed up with the hardcoded dir replaced w/ a var + the GHA side would need to cache the file.

  2. moved this from 📑 Ready 👌 to 🗒️ Backlog 📝 in 📅 Procrastinating in public 😵‍💫on May 20, 2026
  3. harshitethic commented on Aug 30, 2026

  4. MugdhoAI commented on Oct 22, 2026

    I’m interested in contributing to this issue and have reviewed the proposed approach. Before I start, could a maintainer confirm whether this is still available to work on, given the existing expression of interest, and whether the intended direction is to reuse the previous linkcheck output in PR and merge queue runs so only newly introduced URLs are checked?

    I would verify the current workflow and add focused tests before opening a PR.

  5. merwok commented on Oct 22, 2026

    Contributor

    We prefer contributions from people interested in becoming contributors, or even interesting in using their time, energy and intellect to solve a problem. A human interface to a robotic tool adds more burden than help to the few reviewers.

  6. rgommers commented on Nov 11, 2026

    Contributor

    This is very much not trivial (see 7 linked PRs in the sidebar), and it is quite annoying that CI is red all the time, so I had a go at this in gh-2182. The high-level approach follows what @webknjaz suggested.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: taskSomething that needs to be done that is not a bug or feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL