diff --git a/.github/workflows/address-sanitizer.yml b/.github/workflows/address-sanitizer.yml index 8cb6109..071ed9e 100644 --- a/.github/workflows/address-sanitizer.yml +++ b/.github/workflows/address-sanitizer.yml @@ -24,7 +24,7 @@ jobs: persist-credentials: false - name: Install the latest version of uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Install packages run: | diff --git a/.github/workflows/clang-analyzer.yml b/.github/workflows/clang-analyzer.yml index b84ca68..0ed0bec 100644 --- a/.github/workflows/clang-analyzer.yml +++ b/.github/workflows/clang-analyzer.yml @@ -23,7 +23,7 @@ jobs: run: sudo apt install clang-tools - name: Install the latest version of uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Build and run analyzer # We exclude extension/libmaxminddb/ as libmaxminddb has its own workflow diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4b8b6eb..1dadabb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: languages: python, cpp - name: Install the latest version of uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - run: uv build env: diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 0000000..5e3255b --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,32 @@ +name: Links + +on: + push: + pull_request: + schedule: + - cron: "0 13 * * 1" # weekly, to catch external link rot without a commit + workflow_dispatch: + +permissions: + contents: read + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Setup mise + uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 # v3.6.1 + with: + install: false + + # Install only lychee (not the repo's full toolchain) and run the check. + - name: Check links + env: + MISE_AUTO_INSTALL: "false" + run: | + mise install lychee + mise run check-links diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da70394..3f9dd26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,7 +75,7 @@ jobs: sudo udevadm trigger --name-match=kvm - name: Build wheels - uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # 3.4.1 + uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 env: CIBW_ENABLE: pypy pypy-eol CIBW_PLATFORM: ${{ matrix.platform }} @@ -118,4 +118,4 @@ jobs: path: dist merge-multiple: true - - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # 1.14.0 + - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 diff --git a/.github/workflows/test-libmaxminddb.yml b/.github/workflows/test-libmaxminddb.yml index 03e1c4f..ff51003 100644 --- a/.github/workflows/test-libmaxminddb.yml +++ b/.github/workflows/test-libmaxminddb.yml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: Install the latest version of uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Install tox run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv --with tox-gh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9d582f..715d9e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: submodules: true persist-credentials: false - name: Install the latest version of uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # 8.1.0 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Install tox run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv --with tox-gh - name: Install Python diff --git a/.gitignore b/.gitignore index d63bdb7..51e6195 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .coverage .eggs .idea +.lycheecache .pyre .tox build diff --git a/README.rst b/README.rst index 30ce298..87ba401 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@ Usage To use this module, you must first download or create a MaxMind DB file. We provide `free GeoLite databases -`_. These +`_. These files must be decompressed with ``gunzip``. After you have obtained a database and imported the module, call @@ -116,5 +116,6 @@ Please report all issues with this code using the `GitHub issue tracker `_ If you are having an issue with a MaxMind service that is not specific to this -API, please contact `MaxMind support `_ for +API, please contact `MaxMind support +`_ for assistance. diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 0000000..928b049 --- /dev/null +++ b/lychee.toml @@ -0,0 +1,67 @@ +# Lychee link checker configuration +# https://lychee.cli.rs/#/usage/config +# +# Run locally with: +# lychee './**/*.md' './**/*.rst' './maxminddb/**/*.py' './pyproject.toml' + +# Include URL fragments in checks +include_fragments = true + +# Don't allow any redirects, so links that have moved are surfaced and can be +# updated to their canonical destination. +max_redirects = 0 + +# Accept these HTTP status codes +# 100-103: Informational responses +# 200-299: Success responses +# 403: Forbidden (some sites use this for rate limiting) +# 429: Too Many Requests +# 500-599: Server errors (temporary issues shouldn't fail CI) +# 999: LinkedIn's custom status code +accept = ["100..=103", "200..=299", "403", "429", "500..=599", "999"] + +# Exclude URL patterns from checking (treated as regular expressions) +exclude = [ + # GitHub blob URLs with line-number fragments (not parseable as page anchors) + '^https://github\.com/[^/]+/[^/]+/blob/[0-9a-fA-F]+/.+#L\d+$', + # Live / auth-gated MaxMind endpoints: appear as code string literals or + # require login, so they can't be verified by an anonymous request. + '^https://geoip\.maxmind\.com', + '^https://geolite\.info', + '^https://minfraud\.maxmind\.com', + '^https://sandbox\.maxmind\.com', + '^https://updates\.maxmind\.com', + '^https://www\.maxmind\.com/en/accounts/', + '^https://www\.maxmind\.com/en/account/login', + # Local / placeholder URLs (e.g. the proxy example in docstrings) + '^file://', + '^https?://example\.(com|org|net)', + '^http://localhost', + '127\.0\.0\.1', +] + +# Exclude file paths from getting checked (regular expressions, matched against +# the path relative to the working directory). Patterns are segment-anchored +# with (^|/) so short names like "build" don't match unintended paths. +exclude_path = [ + '(^|/)node_modules/', + '(^|/)\.venv/', + '(^|/)venv/', + '(^|/)build/', + '(^|/)dist/', + '(^|/)\.eggs/', + '(^|/)[^/]*\.egg-info/', + '(^|/)docs/_build/', + # Vendored git submodules (upstream C library and shared test fixtures) + '(^|/)extension/libmaxminddb/', + '(^|/)tests/data/', + # Changelog: historical entries are preserved as-is, not rewritten + '(^|/)HISTORY\.rst$', +] + +# Cache results for 1 day to speed up repeated checks +cache = true +max_cache_age = "1d" + +# Skip missing input files instead of erroring +skip_missing = true diff --git a/mise.lock b/mise.lock new file mode 100644 index 0000000..156e912 --- /dev/null +++ b/mise.lock @@ -0,0 +1,29 @@ +# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html + +[[tools.lychee]] +version = "0.23.0" +backend = "aqua:lycheeverse/lychee" + +[tools.lychee."platforms.linux-arm64"] +checksum = "sha256:97eb93b02a7d78a752fc33e5b0983439ccaadbf3db952b68a0a4401acd92e6e0" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-aarch64-unknown-linux-gnu.tar.gz" + +[tools.lychee."platforms.linux-arm64-musl"] +checksum = "sha256:97eb93b02a7d78a752fc33e5b0983439ccaadbf3db952b68a0a4401acd92e6e0" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-aarch64-unknown-linux-gnu.tar.gz" + +[tools.lychee."platforms.linux-x64"] +checksum = "sha256:5538440d2c69a45a0a09983271e5dee0c2fe7137d8035d25b2632e10a66a090a" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-x86_64-unknown-linux-musl.tar.gz" + +[tools.lychee."platforms.linux-x64-musl"] +checksum = "sha256:5538440d2c69a45a0a09983271e5dee0c2fe7137d8035d25b2632e10a66a090a" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-x86_64-unknown-linux-musl.tar.gz" + +[tools.lychee."platforms.macos-arm64"] +checksum = "sha256:4c8034900e11083b68ac6f6582c377ff1f704e268991999e09d717973e493e7f" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-arm64-macos.dmg" + +[tools.lychee."platforms.windows-x64"] +checksum = "sha256:0fda7ff0a60c0250939fc25361c2d4e6e7853c31c996733fdd5a1dd760bcb824" +url = "https://github.com/lycheeverse/lychee/releases/download/lychee-v0.23.0/lychee-x86_64-windows.exe" diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..10b7812 --- /dev/null +++ b/mise.toml @@ -0,0 +1,9 @@ +[settings] +lockfile = true + +[tools] +lychee = "latest" + +[tasks.check-links] +description = "Check links with lychee" +run = "lychee --no-progress './**/*.md' './**/*.rst' './maxminddb/**/*.py' './pyproject.toml'" diff --git a/pyproject.toml b/pyproject.toml index 8a43043..78e2559 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://www.maxmind.com/" -Documentation = "https://maxminddb.readthedocs.org/" +Homepage = "https://www.maxmind.com/en/home" +Documentation = "https://maxminddb.readthedocs.io/en/latest/" "Source Code" = "https://github.com/maxmind/MaxMind-DB-Reader-python" "Issue Tracker" = "https://github.com/maxmind/MaxMind-DB-Reader-python/issues"