57 lines
1.4 KiB
Markdown
57 lines
1.4 KiB
Markdown
# Default Config
|
|
|
|
Baseline mypy and ruff settings used when `pyproject.toml` is absent or incomplete.
|
|
|
|
## mypy (strict mode)
|
|
|
|
```ini
|
|
[mypy]
|
|
python_version = 3.13
|
|
strict = true
|
|
warn_return_any = true
|
|
warn_unused_ignores = true
|
|
warn_redundant_casts = true
|
|
disallow_untyped_defs = true
|
|
disallow_incomplete_defs = true
|
|
check_untyped_defs = true
|
|
disallow_any_generics = true
|
|
no_implicit_reexport = true
|
|
```
|
|
|
|
## ruff
|
|
|
|
```toml
|
|
[tool.ruff]
|
|
target-version = "py313"
|
|
line-length = 88
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"UP", # pyupgrade
|
|
"B", # flake8-bugbear
|
|
"SIM", # flake8-simplify
|
|
"I", # isort
|
|
"RUF", # ruff-specific
|
|
"ANN", # flake8-annotations (public API must be typed)
|
|
]
|
|
ignore = [
|
|
"ANN101", # missing type for self
|
|
"ANN102", # missing type for cls
|
|
]
|
|
```
|
|
|
|
## pyproject.toml Priority Rules
|
|
|
|
When `pyproject.toml` exists, always prefer its values over these defaults:
|
|
|
|
| Config key | Behaviour |
|
|
|---|---|
|
|
| `[tool.mypy] strict = false` | Still enforce strict — mention the deviation to the user |
|
|
| `[tool.mypy] python_version` | Use as-is; warn if < 3.13 |
|
|
| `[tool.ruff.lint] ignore` | Respect fully — do not flag ignored rules |
|
|
| `[tool.ruff] line-length` | Use for E501; default 88 if absent |
|
|
| `[tool.ruff.lint] select` | Merge with defaults — do not drop user selections |
|