Sphinx Lint
Sphinx Lint is based on rstlint.py from CPython.
What is Sphinx Lint, what is it not?
Sphinx Lint should:
- be reasonably fast so it's comfortable to use as a linter in your editor.
- be usable on a single file.
- not give any false positives (probably a utopia, but let's try).
- not spend too much effort finding errors that sphinx-build already finds (or can easily find).
- focus on finding errors that are not visible to sphinx-build.
Using Sphinx Lint
Here are some example invocations of Sphinx Lint from the command line:
sphinx-lint # check all dirs and files
sphinx-lint file.rst # check a single file
sphinx-lint docs # check a directory
sphinx-lint -i venv # ignore a file/directory
sphinx-lint -h # for more options
Sphinx Lint can also be used via pre-commit. We recommend using a configuration like this:
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: LATEST_SPHINXLINT_RELEASE_TAG
hooks:
- id: sphinx-lint
Known issues
Currently Sphinx Lint can't work with tables, there's no understanding
of how linesplit works in tables, like:
+-----------------------------------------+-----------------------------+---------------+
| Method | Checks that | New in |
+=========================================+=============================+===============+
| :meth:`assertEqual(a, b) | ``a == b`` | |
| <TestCase.assertEqual>` | | |
+-----------------------------------------+-----------------------------+---------------+
as Sphinx Lint works line by line it will inevitably think the :meth: role is not closed properly.
To avoid false positives, some rules are skipped if we're in a table.
Contributing
A quick way to test if some syntax is valid from a pure
reStructuredText point of view, one case use docutils's pseudoxml
writer, like:
$ docutils --writer=pseudoxml tests/fixtures/xpass/role-in-code-sample.rst
<document source="tests/fixtures/xpass/role-in-code-sample.rst">
<paragraph>
Found in the pandas documentation, this is valid:
<bullet_list bullet="*">
<list_item>
<paragraph>
A pandas class (in the form
<literal>
:class:`pandas.Series`
)
<list_item>
<paragraph>
A pandas method (in the form
<literal>
:meth:`pandas.Series.sum`
)
<list_item>
<paragraph>
A pandas function (in the form
<literal>
:func:`pandas.to_datetime`
)
<paragraph>
it's documenting roles using code samples (double backticks).
Releasing
-
Make sure that the CI tests pass and optionally double-check locally with "friends projects" by running:
sh download-more-tests.sh python -m pytest -
Go on the Releases page
-
Click "Draft a new release"
-
Click "Choose a tag"
-
Type the next vX.Y.Z version and select "Create new tag: vX.Y.Z on publish"
-
Leave the "Release title" blank (it will be autofilled)
-
Click "Generate release notes" and amend as required
-
Click "Publish release"
-
Check the tagged GitHub Actions build has deployed to PyPI
License
As this script was in the CPython repository the license is the Python Software Foundation Licence Version 2, see the LICENSE file for a full version.
Metadata
Release files for sphinx-lint 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx_lint-1.0.2.tar.gz | 36.9 kB | With provenance | Details for sphinx_lint-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_lint-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for sphinx_lint-1.0.2-py3-none-any.whl |
Total release size: 57.5 kB
Release files / sphinx_lint-1.0.2.tar.gz
| Download URL | sphinx_lint-1.0.2.tar.gz |
|---|---|
| Size | 36.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e7fc12f44f750b0006eaad237d7db9b1d8aba92adda9c838af891654b371d35
|
|
BLAKE2b-256 checksum How to use checksums |
8a199258497fee6e2a0bdb93e8ecea6ef6864afb5d83e996a1606a853f96c658
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 19, 2025.
Transparency logRelease files / sphinx_lint-1.0.2-py3-none-any.whl
| Download URL | sphinx_lint-1.0.2-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
edcd0fa4d916386c5a3ef7ef0f5136f0bb4a15feefc83c1068ba15bc16eec652
|
|
BLAKE2b-256 checksum How to use checksums |
c062f29a2988ff706ac01d3c63d0b4cc4ed62d2c83b447916e0317790ca156cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 19, 2025.
Transparency logSecurity for sphinx-lint 1.0.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sphinx_lint-1.0.2.tar.gz
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 Nov 19, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.