Skip to main content

stolid

A flake8 plugin that enforces opinionated Python coding conventions for clean, maintainable code.

Stolid encourages:

  • Composition over inheritance

  • Dependency injection over mocking

  • Protocol-based typing over abstract base classes

  • Immutable dataclasses

  • Small, focused functions and classes

Installation

pip install stolid

Usage

Run stolid as a module to check your code:

python -m stolid your_package/

python -m stolid is the unified entry point. It runs the flake8 plugin (which emits every per-file SLDxxx code) and then the cross-file scanners that produce the SLD80x public-contract diagnostics, exiting with the worst of the two stages’ exit codes. Paths default to . if none are given.

Running flake8 directly still works and is fine for editor integration, but it only loads the in-file plugin — the SLD80x cross-file checks require the workspace-wide view that python -m stolid provides:

flake8 your_code.py  # in-file SLDxxx only, no SLD80x

Error Codes

Every diagnostic is an SLDxxx code, grouped by leading digit so a whole family can be reasoned about — or silenced — together:

  • SLD1xx — testing and dynamic execution: no unittest.mock.patch, no exec / eval / __import__.

  • SLD2xx — abstract base classes: prefer Protocol over ABC, and keep any single module’s imported surface narrow.

  • SLD3xx — object-oriented design: boring constructors, no private methods, and real enums instead of stringly-typed values.

  • SLD4xx — inheritance: no subclassing of concrete classes.

  • SLD5xx — dataclass configuration: frozen, slots, and kw_only on every dataclass.

  • SLD6xx — code complexity: bounded function weight, argument and method counts, context-manager-friendly cleanup, and enumerate / iteration over manual range(len(...)) and while-index walks.

  • SLD7xx — naming: no vague words, no shadowing of stdlib names, no confusable near-duplicate names.

  • SLD8xx — cross-file contracts, documentation, and import-graph architecture: the checks that need a workspace-wide view and run via python -m stolid.

  • SLD9xx — privacy: the underscore-prefix convention across attributes, modules, and imports.

The full catalog — every code with its rationale and bad/good examples — lives in the documentation under doc/error-codes/ (one page per family).

Configuration

Stolid follows standard flake8 configuration. Add to your setup.cfg or .flake8:

[flake8]
extend-ignore = SLD301,SLD302

Or use per-file ignores:

[flake8]
per-file-ignores =
    tests/*:SLD301,SLD302

Development

pip install nox

# Run all checks
nox

# Run specific sessions
nox -s tests    # Run tests with coverage
nox -s lint     # Run black and flake8
nox -s mypy     # Run type checking

License

MIT License. See LICENSE for details.

Metadata

Release files for stolid 2026.10.24.22243

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

Source distribution (sdist)

Source distribution for stolid 2026.10.24.22243
File Size Uploaded Provenance Actions
stolid-2026.10.24.22243.tar.gz 96.5 kB With provenance Details for stolid-2026.10.24.22243.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stolid 2026.10.24.22243
File Interpreter ABI Platform Actions
stolid-2026.10.24.22243-py3-none-any.whl Python 3 none any Details for stolid-2026.10.24.22243-py3-none-any.whl

Total release size: 226.3 kB

Release files / stolid-2026.10.24.22243.tar.gz

Download URL stolid-2026.10.24.22243.tar.gz
Size 96.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c270a28a57b3224dbd83ce2cc9f82554fc8bbb5c388e8bc64c54a75508cc1c1d
BLAKE2b-256 checksum
How to use checksums
e754a88cbc70f757775c938025ca3b11fb35fcb98e8f1a4820a1a3e7ad27c1ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 24, 2026.

Transparency log

Release files / stolid-2026.10.24.22243-py3-none-any.whl

Download URL stolid-2026.10.24.22243-py3-none-any.whl
Size 129.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b70cd634fbd7fc8c1b4ff7c34dd8a1e4690cf010ed3f03a8a2031441c34cde6
BLAKE2b-256 checksum
How to use checksums
b52a107173ca1197bc1f44097a03bcf947be52747f9b8fa598252b6607206fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 24, 2026.

Transparency log

Security for stolid 2026.10.24.22243

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.

Select from 2 files

Attestation for stolid-2026.10.24.22243.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 Oct 24, 2026.

Transparency log

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.

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