boilerplate-py/pyproject.toml

190 lines
4.6 KiB
TOML

#####################
# Python packaging: #
[build-system]
requires = [
"setuptools",
"setuptools-scm",
]
build-backend = "setuptools.build_meta"
[project]
name = "${REPO_NAME}"
description = "${REPO_DESCRIPTION}"
authors = [
{ name = ..., email = ... },
]
maintainers = [
{ name = ..., email = ... },
]
requires-python = ">=3.8, <4.0"
keywords = [
...
]
license = { text = "Apache Software License Version 2.0" }
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
# "Intended Audience :: Developers",
# "Framework :: AsyncIO",
# "Topic :: Internet",
...
]
dynamic = [
"dependencies",
"readme",
"version",
]
[project.optional-dependencies]
full = []
dev = [
"black==23.10.1",
"build==1.0.3",
"coverage[toml]==7.3.2",
"isort==5.12.0",
"mkdocs-material==9.4.6",
"mkdocstrings[python]==0.23.0",
"mypy==1.5.1",
"pytest==7.4.3",
"ruff==0.1.3",
]
[project.urls]
"Repository" = "https://github.com/${REPO_OWNER_LOWER}/${REPO_NAME_LOWER}"
"Issue Tracker" = "https://github.com/${REPO_OWNER_LOWER}/${REPO_NAME_LOWER}/issues"
"Documentation" = "http://${REPO_OWNER_LOWER}.github.io/${REPO_NAME_LOWER}"
[tool.setuptools.dynamic]
dependencies = { file = "requirements/base.txt" }
readme = { file = ["README.md"], content-type = "text/markdown" }
version = { attr = ..."${REPO_NAME}.__version__" }
#########################
# Static type checking: #
[tool.mypy]
cache_dir = ".cache/mypy"
files = [
"src/",
"tests/",
]
warn_unused_configs = true
strict = true
show_error_codes = true
plugins = []
############
# Testing: #
[tool.pytest.ini_options]
cache_dir = ".cache/pytest"
addopts = "-ra -v"
testpaths = [
"tests",
]
#######################
# Unit test coverage: #
[tool.coverage.run]
data_file = ".cache/coverage"
source = [
"src/",
]
branch = true
command_line = "-m pytest -qq"
omit = [
".venv*/*",
]
[tool.coverage.report]
show_missing = true
skip_covered = false
exclude_lines = [
"if TYPE_CHECKING:",
'''if __name__ == ['"]__main__['"]:''',
"@overload",
]
omit = [
"tests/*",
]
###############################
# Linting and style checking: #
[tool.ruff]
cache-dir = ".cache/ruff"
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"N", # pep8-naming
"D", # pydocstyle
"ANN", # flake8-annotations
"S", # flake8-bandit
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear
"A", # flake8-builtins
"C", # flake8-comprehensions
"PIE", # flake8-pie
"T20", # flake8-print
"RET", # flake8-return
"SIM", # flake8-simplify
"TD", # flake8-todos
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PL", # pylint
"TRY", # tryceratops
"RUF", # ruff-specific
]
ignore = [
"E501", # Line too long -> handled by black
"D203", # 1 blank line required before class docstring -> D211 is better
"D212", # Multi-line docstring summary should start at the first line -> ugly, D213 is better
"D401", # First line of docstring should be in imperative mood -> no, it shouldn't
"D407", # Missing dashed underline after section -> different docstring style
"ANN101", # Missing type annotation for self in method -> unnecessary
"ANN102", # Missing type annotation for cls in classmethod -> unnecessary
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed -> we'll use it sparingly
"N818", # Exception name should be named with an Error suffix -> absolutely not
]
[tool.ruff.per-file-ignores]
"src/**/__init__.py" = [
"A001", # Variable {name} is shadowing a Python builtin
"D104", # Missing docstring in public package
"F401", # {...} imported but unused
]
"tests/*.py" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"S101", # Use of `assert` detected
"FBT", # flake8-boolean-trap
"TRY", # tryceratops
]
####################
# Code formatting: #
[tool.black]
line_length = 80
###################
# Import sorting: #
[tool.isort]
profile = "black"
extra_standard_library = ["typing_extensions"]
line_length = 80