Linter enforcing the conventions of the Python standard template
Project description
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, and context-manager-friendly cleanup.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stolid-2026.5.30.77750.tar.gz.
File metadata
- Download URL: stolid-2026.5.30.77750.tar.gz
- Upload date:
- Size: 87.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a16384493cb8b710054a6a58b7a7a3eab5fe0451c427194eae649140bcb487
|
|
| MD5 |
5050ef78b49c4341fca30c080c25e9c2
|
|
| BLAKE2b-256 |
c3753229672582a3e4976f2802bddebb24f25b6c60a1f3ef48d8a92c14608af5
|
Provenance
The following attestation bundles were made for stolid-2026.5.30.77750.tar.gz:
Publisher:
release.yml on moshez/stolid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stolid-2026.5.30.77750.tar.gz -
Subject digest:
04a16384493cb8b710054a6a58b7a7a3eab5fe0451c427194eae649140bcb487 - Sigstore transparency entry: 1676528530
- Sigstore integration time:
-
Permalink:
moshez/stolid@aeb09f63f6806e23891b6834927e74a94a77478e -
Branch / Tag:
refs/heads/trunk - Owner: https://github.com/moshez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aeb09f63f6806e23891b6834927e74a94a77478e -
Trigger Event:
push
-
Statement type:
File details
Details for the file stolid-2026.5.30.77750-py3-none-any.whl.
File metadata
- Download URL: stolid-2026.5.30.77750-py3-none-any.whl
- Upload date:
- Size: 117.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f84ea6be2d7d31d46b2edba5cd29ff6854b126f4ebc50f93b9e8adb421f70065
|
|
| MD5 |
3620eb6d7c7f6ecb446d65f76bccc946
|
|
| BLAKE2b-256 |
714dafc6b5e933cf8a9e733623bae4276cbb23e1e7fcfd619bc8eb03923b0889
|
Provenance
The following attestation bundles were made for stolid-2026.5.30.77750-py3-none-any.whl:
Publisher:
release.yml on moshez/stolid
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stolid-2026.5.30.77750-py3-none-any.whl -
Subject digest:
f84ea6be2d7d31d46b2edba5cd29ff6854b126f4ebc50f93b9e8adb421f70065 - Sigstore transparency entry: 1676528536
- Sigstore integration time:
-
Permalink:
moshez/stolid@aeb09f63f6806e23891b6834927e74a94a77478e -
Branch / Tag:
refs/heads/trunk - Owner: https://github.com/moshez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aeb09f63f6806e23891b6834927e74a94a77478e -
Trigger Event:
push
-
Statement type: