max-lint
One command that runs black, isort, flake8, mypy and pytest with a single shared configuration. Every tool is pinned to an exact version.
Status (November 2026): max-lint is published on PyPI. The lint command runs black, isort, flake8 and mypy with the bundled style, the test command runs pytest with branch coverage and a coverage floor, and a bare max-lint runs both.
Contents
- Install
- Usage
- Configuration
- Bundled style
- Project mypy and pytest settings
- Commands and exit codes
- Known limitations
- Contributing
- License
Install
Requires Python 3.13 or newer and uv. Add max-lint to a project as a development dependency, from a directory whose pyproject.toml has a [project] table with name and version:
uv add --dev max-lint
Usage
A project declares what it owns in a [tool.max-lint] table of its pyproject.toml. Run the commands with uv run from the directory that holds pyproject.toml. This project, with max-lint added as above:
# pyproject.toml
[project]
name = "inventory"
version = "0.1.0"
requires-python = ">=3.13"
[tool.max-lint]
paths = ["src"]
test-paths = ["tests"]
coverage-source = ["src/inventory"]
[tool.pytest.ini_options]
pythonpath = ["src"]
# src/inventory/__init__.py
"""Inventory tracking."""
# src/inventory/stock.py
"""Stock levels per item."""
def restock(levels: dict[str, int], item: str, count: int) -> dict[str, int]:
"""
Return a copy of ``levels`` with ``count`` more of ``item``.
:param levels: current stock per item.
:return: the updated stock.
"""
return {**levels, item: levels.get(item, 0)+count}
# tests/test_stock.py
"""Tests for stock levels."""
from inventory.stock import restock
def test_restock_adds_to_existing_item() -> None:
"""Restocking an item adds to its count."""
assert restock({'apple': 1}, 'apple', 2) == {'apple': 3}
max-lint lint --check on the example:
$ uv run max-lint lint --check
would reformat src/inventory/stock.py
would reformat tests/test_stock.py
Oh no! 💥 💔 💥
2 files would be reformatted, 1 file would be left unchanged.
max-lint lint rewrites the files with black, then isort, then runs flake8 and mypy:
$ uv run max-lint lint
reformatted src/inventory/stock.py
reformatted tests/test_stock.py
All done! ✨ 🍰 ✨
2 files reformatted, 1 file left unchanged.
src/inventory/stock.py:4:1: DOC101 Function `restock`: Docstring contains fewer arguments than in function signature.
src/inventory/stock.py:4:1: DOC103 Function `restock`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [count: int, item: str].
Once flake8 passes, mypy runs last. With src/inventory/__init__.py and tests/test_stock.py as the previous command left them, a completed restock docstring in src/inventory/stock.py:
# src/inventory/stock.py
"""Stock levels per item."""
def restock(levels: dict[str, int], item: str, count: int) -> dict[str, int]:
"""
Return a copy of ``levels`` with ``count`` more of ``item``.
:param levels: current stock per item.
:param item: the item to restock.
:param count: how many to add.
:return: the updated stock.
"""
return {**levels, item: levels.get(item, 0) + count}
and a new module that passes a string where restock expects an int:
# src/inventory/report.py
"""Stock report."""
from inventory.stock import restock
def weekly_delivery() -> dict[str, int]:
"""
Return the stock after the weekly delivery.
:return: the updated stock.
"""
return restock({"apple": 1}, "apple", "3")
the same command ends in mypy:
$ uv run max-lint lint
All done! ✨ 🍰 ✨
4 files left unchanged.
src/inventory/report.py:12: error: Argument 3 to "restock" has incompatible type "str"; expected "int" [arg-type]
Found 1 error in 1 file (checked 3 source files)
max-lint test runs pytest over test-paths and measures coverage-source with branch coverage. Delete src/inventory/report.py from the example above, which leaves stock.py as completed there, and the tests pass:
$ uv run max-lint test
============================= test session starts ==============================
platform <platform> -- Python <python>, pytest-<version>, pluggy-<version>
rootdir: <project>
configfile: pyproject.toml
plugins: platformdirs-<version>, cov-<version>, socket-<version>
collected 1 item
tests/test_stock.py . [100%]
================================ tests coverage ================================
_______________ coverage: platform <platform>, python <python-build> _______________
Name Stmts Miss Branch BrPart Cover Missing
-------------------------------------------------------------------------
src/inventory/__init__.py 0 0 0 0 100.00%
src/inventory/stock.py 2 0 0 0 100.00%
-------------------------------------------------------------------------
TOTAL 2 0 0 0 100.00%
Coverage JSON written to file <tmp>/coverage.json
Required test coverage of 95% reached. Total coverage: 100.00%
============================== 1 passed in <seconds>s ===============================
The output shows <project> for the project directory, <tmp> for a temporary directory, <platform> for the operating system, <python> for the Python version, <python-build> for the Python version with its release level, <version> for the version of the package named before it, and <seconds> for the run time. Coverage writes its data file, .coverage, to the project directory.
A bare max-lint on the example project as it was for the passing test run prints the lint tools' results first, followed by the pytest output shown above:
$ uv run max-lint
All done! ✨ 🍰 ✨
3 files left unchanged.
Success: no issues found in 2 source files
Configuration
The [tool.max-lint] table takes these keys and no others:
| Key | Type | Required | Meaning |
|---|---|---|---|
paths |
list of strings | yes | Source paths to format, lint and type-check. |
test-paths |
list of strings | no | Test paths: exempt from the pydoclint DOC codes and run by pytest, so the test step needs at least one. |
coverage-source |
list of strings | no | Packages or directories to measure, as pytest-cov's --cov takes them; the test step needs at least one. |
coverage-omit |
list of strings | no | Glob patterns of files to leave out of the measurement; one not starting with * is relative to pyproject.toml. |
exclude |
list of strings | no | Extra flake8-style exclude patterns such as "src/inventory/generated", removed from black, isort and flake8 alike. |
per-file-ignores |
table of glob to list of strings | no | Flake8 codes to ignore per file, such as { "src/inventory/legacy.py" = ["D103"] }; a glob matches a file's path relative to pyproject.toml, and * also matches /. |
Every path in paths and test-paths must exist; paths are relative to pyproject.toml and may point outside its directory. Ignored codes add up per file: the DOC exemption of test paths, D104 and F401 for every __init__.py, and the codes of every per-file-ignores entry whose glob matches.
Bundled style
The tools are black, isort, flake8, mypy, pytest, pytest-cov, pytest-socket and coverage, each pinned to an exact version in pyproject.toml. The flake8 plugins are flake8-annotations, flake8-docstrings, flake8-rst-docstrings, flake8-commas, flake8-multiline-containers and pydoclint.
- black and isort use line length 130, and isort uses
profile = "black". black targets the Python versions allowed byrequires-python. - flake8 selects
ANN401in addition to its defaults and ignoresE203andE501. pydoclint checks Sphinx-style docstrings without argument types in the docstring and skips private functions and return types. - Docstrings are parsed with the
rawandincludedirectives disabled, so flake8 reports each use asRST299. - mypy always runs with
disallow_untyped_defs,warn_redundant_castsandno_implicit_optional. - Coverage is branch coverage with a floor of 95% compared to two decimals, the missing lines shown, and
pragma: no coverandif __name__ == .__main__.:as the excluded lines. - pytest runs with
--import-mode=importlib, and the current directory is importable, so a project that is not an installed package can import its own modules in its tests.
Settings for these tools in the project ([tool.black], [tool.isort], .flake8, setup.cfg, tox.ini, .isort.cfg, [tool.coverage.*], .coveragerc and .coveragerc.toml) have no effect.
Project mypy and pytest settings
mypy checks the files under paths only, so test code is not type-checked unless a paths entry also covers it. Apart from the three locked settings, it reads the [tool.mypy] table and the [[tool.mypy.overrides]] entries of the project's pyproject.toml, such as python_version, plugins and per-module ignore_missing_imports; a project with no [tool.mypy] table works, and no other mypy configuration file (mypy.ini, setup.cfg) is read:
[tool.mypy]
python_version = "3.13"
[[tool.mypy.overrides]]
module = ["legacy_sdk.*"]
ignore_missing_imports = true
A project that sets one of the three locked settings in [tool.mypy] or in an override, under any name mypy accepts for it (allow_untyped_defs, for example), gets exit status 2 before any tool runs. mypy resolves third-party imports from the environment max-lint runs in, and writes its cache to .mypy_cache in the current directory. A plugin named by module must be importable from that environment because the working directory is not on the import path; a plugin given as a file path works. The project's [tool.pytest.ini_options] is read, so keys such as pythonpath work.
Commands and exit codes
max-lintruns the lint steps, then the test step;max-lint --checkdoes the same with black and isort in their check modes.max-lint lintformats with black and isort, then runs flake8 and mypy;max-lint lint --checkrewrites no files.max-lint testruns pytest with coverage.max-lint --helpprints the available commands andmax-lint --versionthe installed version.
Every command stops at the first step that fails. The exit status is 0 when every step passes and 1 when a tool reports a failure. The test step also exits 1 when coverage measures no file that contains a statement, even if every test passed. With coverage-omit = ["src/inventory/stock.py"] added to the example's [tool.max-lint], the only file left in the measurement is the docstring-only __init__.py. The output is the same as in the passing run except that the stock.py row is gone, TOTAL counts no statements, and the last line is added:
$ uv run max-lint test
src/inventory/__init__.py 0 0 0 0 100.00%
TOTAL 0 0 0 0 100.00%
max-lint: coverage measured no files that contain statements; check 'coverage-source' and 'coverage-omit' in [tool.max-lint].
Exit status 2 and a one-line message on stderr mean a configuration error in pyproject.toml or its [tool.max-lint] table. The message says what to fix. A bare max-lint reports a configuration error of the test step before it rewrites any file. A usage error, such as an unknown command or option, also exits 2.
Known limitations
max-lint testand a baremax-lintrun the project's tests, so the project's code, itsconftest.pyfiles and its pytest configuration execute. Coverage can be changed from inside that code, for example through the coverage API in aconftest.py.- A project's
[tool.mypy]table is trusted configuration. Plugins named there are loaded and run, and other settings there can make mypy write and read files outside the project and expand environment variables, somax-lint lintis not a read-only operation on a repository that has that table. - A
coverage-sourceentry that matches nothing only prints a coverage warning and does not fail the run while another entry measures code. - Two
pathsentries that each hold a module of the same name without an__init__.pymake mypy report a duplicate module and the lint run fail. - A file named like a library module that mypy uses, such as
typing_extensions.pyin the project root, makes the mypy step fail. max-lint --check testaccepts--checkwithout effect: the tests run and no formatting is checked.
Contributing
Setup, the checks a change must pass and the rules for the bundled style are in CONTRIBUTING.md. max-lint is maintained by Rodrigo Carvajal; bugs and proposals go in GitHub issues.
License
Metadata
Release files for max-lint 0.6.1
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 |
|---|---|---|---|---|
| max_lint-0.6.1.tar.gz | 72.1 kB | With provenance | Details for max_lint-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| max_lint-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for max_lint-0.6.1-py3-none-any.whl |
Total release size: 91.2 kB
Release files / max_lint-0.6.1.tar.gz
| Download URL | max_lint-0.6.1.tar.gz |
|---|---|
| Size | 72.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29e0e361c45f8257fe88aaf22804c233bf7d563475b9fc46a1603233bdde5e63
|
|
BLAKE2b-256 checksum How to use checksums |
a85a70c56e0b1b16b53f3f6222710ce99aeb9560391f9ead45f9c25593ec5efb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 17, 2026.
Transparency logRelease files / max_lint-0.6.1-py3-none-any.whl
| Download URL | max_lint-0.6.1-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
074ad9258cdd3aaf59681fc2000cc1d93fc2fffa035c8a0fc9fa5c1dccddede2
|
|
BLAKE2b-256 checksum How to use checksums |
11a97d52ac1b1ec886f9c80f7f6f2970bb6d50ac167baf7d1116b9992e5e3201
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 17, 2026.
Transparency logSecurity for max-lint 0.6.1
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 max_lint-0.6.1.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 17, 2026.
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.