lp-lint-doctest is a style checker for Python doctests stored in text files (as opposed to doctests stored in docstrings), optimized for use in Launchpad development. It applies the following checks:
Comments should be in the narrative part of the doctest (i.e. in unindented text) rather than in Python examples.
Narrative text lines are limited to 79 characters.
Source lines in examples (beginning with >>> or ...) are limited to 71 characters.
Expected output lines in examples are limited to 75 characters.
Source and expected output lines should be indented by exactly four spaces.
There should be no trailing whitespace.
reStructuredText-style headings should be used, not MoinMoin-style.
A # noqa comment in any source line in an example suppresses the comment, line length, indentation, and trailing whitespace checks for all lines in that example.
In addition, lp-lint-doctest runs pyflakes on the accumulated source code of each doctest file.
This project was split out from Curtis Hovey’s pocket-lint project. Since that was written, many other excellent linters have arisen for most of the other source types supported by pocket-lint, but there seems to be no other viable replacement for its doctest checks.
lp-lint-doctest supports pre-commit. To use it, add the following to the repos section of your .pre-commit-config.yaml file:
- repo: https://git.launchpad.net/lp-lint-doctest
rev: '' # pick a git tag to point to
hooks:
- id: lp-lint-doctest
If you need to add a custom doctest option flag, then add args: [--allow-option-flag, MY_CUSTOM_FLAG_NAME].
NEWS for lp-lint-doctest
0.5 (2022-09-09)
Bump line length limit to 79 characters, which better matches Launchpad’s black configuration.
0.4 (2021-10-27)
Run on types: [rst] by default. This is a better default for use with repositories other than Launchpad itself (which can override this).
Declare support for Python 3.10.
0.3 (2021-07-27)
Allow # noqa comments to suppress comment checks as well.
0.2 (2021-07-25)
Add --allow-option-flag command-line option to register custom doctest option flags.
Allow comments in source lines in examples if they contain doctest directives.
Allow suppressing checks for an example by adding a # noqa comment to any of its source lines.
0.1 (2021-07-24)
Initial release, split out from pocket-lint.
Metadata
Release files for lp-lint-doctest 0.5
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 |
|---|---|---|---|---|
| lp-lint-doctest-0.5.tar.gz | 11.2 kB | Without provenance | Details for lp-lint-doctest-0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lp_lint_doctest-0.5-py3-none-any.whl | Python 3 | none | any | Details for lp_lint_doctest-0.5-py3-none-any.whl |
Total release size: 22.5 kB
Release files / lp-lint-doctest-0.5.tar.gz
| Download URL | lp-lint-doctest-0.5.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98c7abddabe367093f54630f3dbaa159158e41d3d1e468aef7afb2c869b995fa
|
|
BLAKE2b-256 checksum How to use checksums |
d6e27d366a09b3577eb6e5fa5513913bf7cd29fbb8ae2ce3b20bfcd5cec9f9fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4
|
Release files / lp_lint_doctest-0.5-py3-none-any.whl
| Download URL | lp_lint_doctest-0.5-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9552a7ee5151f1d2fe279a756f25a06018d9befc44817ae7dd7702e8149ea952
|
|
BLAKE2b-256 checksum How to use checksums |
54df7c1ce5c2e4f58839a5316c6b9926d08c97b9158a4b917e966680227dea5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4
|
Security for lp-lint-doctest 0.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.