Skip to main content

sphinx-linklint

This is a Sphinx extension that removes links from excessive references.

It also can be used as command-line linter to find or correct those references in .rst files.

Checks

Sphinx-linklint has two different checks:

  • self: find references that link to their own section. For example, in the description of a class, use :class: referring to itself. These should not be links since they will not take you someplace new.

  • paradup: find multiple identical references within a single paragraph. The first should be a link, but subsequent references don’t need to be links, they are just distractions.

Sphinx extension

To use linklint as a Sphinx extension, add it to the extensions list in your conf.py file:

extensions = [
    # .. probably other extensions are already here..
    "sphinx_linklint.ext",
]

During the build process, linklint will run its checks and remove links from references it considers excessive. No changes are made to the source files.

Command-line use

You can use linklint as a command-line linter:

% sphinx-linklint --help
usage: sphinx-linklint [-h] [--check CHECK] [--fix] files [files ...]

positional arguments:
  files          RST files to lint

options:
  -h, --help     show this help message and exit
  --check CHECK  comma-separated checks to run (self, paradup, all)
  --fix          Fix the issues in place

This can be useful to see what linklint considers excessive, or to modify .rst files to unlink excessive references. Where it can, linklint unlinks references by changing :func:`foo` to :func:`!foo`.

If you agree with linklint’s decisions, the Sphinx extension is a better option, since it doesn’t require changing the source files, and doesn’t hard-code the decisions.

Changes

v2.0.2 (2026-10-04)

Improved performance.

v2.0.1 (2026-08-26)

Fix the sdist for real, closing issue 22.

v2.0.0 (2026-08-25)

Renamed to sphinx-linklint to clarify that this is a Sphinx extension and tool. Fixes issue 19.

Fix the sdist to include all files needed for the project, closing issue 21.

v1.0.3 (2026-08-25)

Publish an updated README under the old linklint name.

v1.0.1 (2026-06-09)

Fix: references that are fully qualified when they don’t need to be are now recognized and will be unlinked.

Fix: references to functions that incorrectly use the :meth: role are recognized by Sphinx anyway, so now linklint also recognizes and unlinks them. Fixes issue 13.

These fixes change the CPython docs build from 1579 self-references unlinked to 1649.

v1.0.0 (2026-05-02)

Fix: the :noindex: directive was ignored, so sections marked as such were considered targets when they shouldn’t have been. This is now fixed.

v0.4.1 (2026-03-27)

Linklint v0.4.0 required Sphinx 9.x, which prevented it from being used by the CPython docs. Now linklint will work with Sphinx 8.x as well.

v0.4.0 (2026-03-10)

A number of roles (:ref:, :doc: and others) were being unlinked when they seemed excessive, but shouldn’t have been. They are explicit references to other parts of the documentation, so should never be removed. This is now fixed.

v0.3.1 (2026-03-01)

Published to PyPI.

v0.3.0 (2026-02-28)

Methods are associated with classes properly in a number of ways.

The Sphinx extension now displays the number of references that were unlinked. The CPython docs report 3612 references unlinked.

v0.2.0 (2026-02-22)

Now available as a Sphinx extension. Instead of changing .rst source files, the excessive links are automatically unlinked in the generated documentation.

v0.1.0 (2026-02-21)

First version: works as a linter with --check and --fix to change .rst source files.

Maintenance

How to work on this repo.

Testing on CPython

To try local changes in the CPython docs:

cd python/cpython/Doc
make clean venv html
mv build build0
sed -i '' "/sphinx-linklint/s@.*@-e $HOME/linklint@" requirements.txt
make clean venv
uv pip install -r requirements.txt
make html
meld build0/html build/html
# or
diff -I 'Last updated on' -r build0/html build/html

Publishing

To release a new version:

  1. Update the Changes section in README.rst

  2. Change the __version__ value in src/sphinx_linklint/__init__.py.

  3. Commit the changes.

  4. Add a tag named for the version, like 1.2.3.

  5. Push the tag, a GitHub action will use trusted publishing to publish to PyPI.

Metadata

Release files for sphinx-linklint 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-linklint 2.0.2
File Size Uploaded
sphinx_linklint-2.0.2.tar.gz 41.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-linklint 2.0.2
File Interpreter ABI Platform
sphinx_linklint-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 54.9 kB

Release files / sphinx_linklint-2.0.2.tar.gz

Download URL sphinx_linklint-2.0.2.tar.gz
Size 41.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e08119e4a0a90997baf867fc8895346bb30798598dc4d274c1632854ca68a9df
BLAKE2b-256 checksum
How to use checksums
218612a57b6e2458bd84b2973e235b3576682e0213ba7f37493f5bbb055c6666
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release files / sphinx_linklint-2.0.2-py3-none-any.whl

Download URL sphinx_linklint-2.0.2-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54993451c264b5dc9beb61e3039cdb234e7f9a9133aad9e61782a8b0a51e085b
BLAKE2b-256 checksum
How to use checksums
43c574980bc587ec161aa5117e9f7ba2ee7fbc1a236f834d9585a142d8de46e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page