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)¶
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.
Config in pyproject.toml:
Linter — ruff check¶
Runs an extensive rule set covering style, correctness, security, and modern Python idioms.
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.
Config in pyproject.toml:
Note
ty is under active development. harness-scaffold pins >=0.0.19. Check releases for updates.
Test runner — pytest¶
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.