From 4e0695cd5462b7df0121e47bc6552ca03c0c93de Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 10 Jun 2025 12:25:39 -0500 Subject: [PATCH 1/4] PYTHON-5393 Make link checking more robust --- .github/workflows/test-python.yml | 4 ++++ doc/conf.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index a2fde83c06..f6dda9ce71 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -125,6 +125,8 @@ jobs: linkcheck: name: Link Check runs-on: ubuntu-latest + permissions: + contents: read steps: - uses: actions/checkout@v4 with: @@ -139,6 +141,8 @@ jobs: - name: Install dependencies run: just install - name: Build docs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: just docs-linkcheck typing: diff --git a/doc/conf.py b/doc/conf.py index 387b939344..fe872325c7 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -4,6 +4,7 @@ # This file is execfile()d with the current directory set to its containing dir. from __future__ import annotations +import os import sys from pathlib import Path @@ -91,6 +92,14 @@ r"https://sourceforge.net/", ] +# Add GitHub auth if available to avoid rate limiting. +if "GH_TOKEN" in os.environ: + token = os.environ["GH_TOKEN"] + linkcheck_request_headers = {r"https://github.\.com/.+": {"authorization": f"Bearer ${token}"}} + +# Allow for flakey links. +linkcheck_retries = 2 + # -- Options for extensions ---------------------------------------------------- autoclass_content = "init" From c2da3f84cdc78eec634f1f7f0bb4a80d2fbb7cb3 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 10 Jun 2025 12:42:36 -0500 Subject: [PATCH 2/4] fix regex --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index fe872325c7..dbfac52bc4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -95,7 +95,7 @@ # Add GitHub auth if available to avoid rate limiting. if "GH_TOKEN" in os.environ: token = os.environ["GH_TOKEN"] - linkcheck_request_headers = {r"https://github.\.com/.+": {"authorization": f"Bearer ${token}"}} + linkcheck_request_headers = {r"https://github\.com/.+": {"authorization": f"Bearer ${token}"}} # Allow for flakey links. linkcheck_retries = 2 From cf19eeb12b7c053142e74c7d22f6016f521f3043 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 10 Jun 2025 13:21:55 -0500 Subject: [PATCH 3/4] try with just retries --- .github/workflows/test-python.yml | 4 ---- doc/conf.py | 12 +++--------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index f6dda9ce71..a2fde83c06 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -125,8 +125,6 @@ jobs: linkcheck: name: Link Check runs-on: ubuntu-latest - permissions: - contents: read steps: - uses: actions/checkout@v4 with: @@ -141,8 +139,6 @@ jobs: - name: Install dependencies run: just install - name: Build docs - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: just docs-linkcheck typing: diff --git a/doc/conf.py b/doc/conf.py index dbfac52bc4..a9711d259f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -4,7 +4,6 @@ # This file is execfile()d with the current directory set to its containing dir. from __future__ import annotations -import os import sys from pathlib import Path @@ -83,7 +82,7 @@ # Options for link checking # The anchors on the rendered markdown page are created after the fact, # so those link results in a 404. -# wiki.centos.org has been flakey. +# wiki.centos.org has been flaky. # sourceforge.net is giving a 403 error, but is still accessible from the browser. linkcheck_ignore = [ "https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.md#requesting-an-immediate-check", @@ -92,13 +91,8 @@ r"https://sourceforge.net/", ] -# Add GitHub auth if available to avoid rate limiting. -if "GH_TOKEN" in os.environ: - token = os.environ["GH_TOKEN"] - linkcheck_request_headers = {r"https://github\.com/.+": {"authorization": f"Bearer ${token}"}} - -# Allow for flakey links. -linkcheck_retries = 2 +# Allow for flaky links. +linkcheck_retries = 3 # -- Options for extensions ---------------------------------------------------- autoclass_content = "init" From 1ac7d188b3b80bb25cc5ea2a4045cd481845ce8e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 10 Jun 2025 13:26:28 -0500 Subject: [PATCH 4/4] Remove troublesome link --- doc/changelog.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index c44cfb41a2..d729f9afed 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1700,8 +1700,7 @@ Changes in Version 3.8.0 (2019/04/22) ------------------------------------- .. warning:: PyMongo no longer supports Python 2.6. RHEL 6 users should install - Python 2.7 or newer from `Red Hat Software Collections - `_. + Python 2.7 or newer from Red Hat Software Collections. CentOS 6 users should install Python 2.7 or newer from `SCL `_