Skip to content

Python Stack

Tools

Purpose Tool Config
Package/env management uv pyproject.toml
Formatter ruff format [tool.ruff]
Linter ruff check [tool.ruff.lint]
Type checker ty [tool.ty]
Test runner pytest [tool.pytest.ini_options]

All tools are installed automatically via uv sync --all-extras during mise run setup.

mise.toml (generated)

[tools]
python = "3.12"
uv = "latest"

Project layout

my-project/
├── pyproject.toml
├── my_project/
│   ├── __init__.py
│   └── example.py
└── tests/
    ├── __init__.py
    └── test_example.py

Formatter — ruff format

Line length 88, enforced on all .py files.

mise run fmt           # format in-place
mise run fmt --check   # check only (used by check/CI)

Config in pyproject.toml:

[tool.ruff]
target-version = "py312"
line-length = 88

Linter — ruff check

Runs an extensive rule set covering style, correctness, security, and modern Python idioms.

mise run lint

Enabled rule sets: E, W, F, I, B, C4, UP, N, S, PTH, RUF.

Type checker — ty

ty is Astral's fast type checker for Python ≥ 3.12.

mise run typecheck

Config in pyproject.toml:

[tool.ty.environment]
python-version = "3.12"

Note

ty is under active development. harness-scaffold pins >=0.0.19. Check releases for updates.

Test runner — pytest

mise run test

Generated projects include pytest-xdist for parallel test execution and pytest-cov for coverage:

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-n auto --dist=loadfile --cov=my_project --cov-report=term-missing -q"

Coverage

pytest-cov is included in generated projects. Reports print to the terminal during mise run test.

Pre-commit parity

The same ruff + ty + pytest commands run in pre-commit hooks via mise run fmt, mise run lint, mise run typecheck, mise run test — identical to CI.