How I configure my pyproject.toml

Posted on Tue 14 February 2023 in Tools

When you have started some python project you will end up with a generic pyproject.toml that you can reuse. This is mine:

[project]
requires-python = ">=3.11"

[tool.black]
line-length = 79
exclude = '/(\.git|\.mypy_cache)/'
target-version = ['py311']

[tool.mypy]
show_error_codes = true

[tool.pytest.ini_options]
testpaths = ['tests']

[tool.ruff]
# Decrease the maximum line length to 79 characters.
target-version = "py311"
line-length = 79
select = [
  "E",   # pycodestyle
  "F",   # pyflakes
  "UP",  # pyupgrade
  "I",   # isort
  "B",   # bugbear
]