-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
191 lines (177 loc) · 5.67 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
[tool.poetry]
name = "python-template-x"
version = "0.4.1"
description = "This is a python template."
authors = ["Mark Beacom <[email protected]>"]
readme = "README.md"
packages = [{include = "python_template"}]
license = "MIT"
keywords = ["app", "cli", "python", "template"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
]
include = [
"README.md",
"LICENSE",
]
[tool.poetry.scripts]
python-template = "python_template.cli:app"
[tool.bandit]
exclude_dirs = ["tests"]
# Styling and linting Configurations
[tool.isort]
profile = "black"
line_length = 120
[tool.black]
line-length = 120
target-version = ["py313"]
[tool.ruff]
# Assume Python 3.13.
target-version = "py313"
# Same as our 120 Black setting.
line-length = 120
[tool.ruff.lint]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
"E", # pycodestyle errors
"F", # pyflakes
"B", # bugbear
"W", # pycodestyle warnings
"C90", # McCabe complexity
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"UP", # pyupgrade
"ANN", # flake8-annotations
"S", # bandit
"ASYNC", # flake8-async
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"FLY", # flynt
]
# Ignore E501 (bugbear line length) by default.
ignore = [
"E501", # line-too-long
"D203", # one-blank-line-before-class
"D213", # multi-line-summary-second-line - Multi-line docstring summary should start at the second line
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # Ignore assert statements in tests
"ARG", # Ignore unused function args, e.g., fixtures
"FBT", # Ignore booleans as positional arguments in tests, e.g., @pytest.mark.parametrize()
]
[tool.coverage.run]
omit = [
"*/tests/*",
"*/__init__.py",
"*/__main__.py",
]
[tool.poe.tasks]
isort = "isort --profile=black ."
black = "black ."
check-black = {cmd = "black . --check --diff", help = "Validate styling with black"}
check-isort = {cmd = "isort --check --profile=black .", help = "Validate import ordering with isort"}
update-precommit-hooks = {cmd = "pre-commit autoupdate --freeze", help = "Update pre-commit hooks and freeze to SHAs"}
check-precommit-hooks = {cmd = "pre-commit run --all-files", help = "Run pre-commit hooks on all files"}
check-ruff = "ruff check python_template"
check-mypy = "mypy python_template"
check = ["check-ruff", "check-isort", "check-black", "check-mypy"]
lint = ["ruff"]
fix = ["ruff", "isort", "black"]
test = "pytest --cov=python_template --cov-report=xml --cov-report=term"
ruff = "ruff check --fix python_template"
safety = "safety check --ignore 70612" # 70612 ignores the jinja2 CVE used by mkdocs
bandit = "bandit -r python_template"
security = ["safety", "bandit"]
# requires poethepoet outside of poetry.
install = "poetry install"
build = "poetry build"
poetry-update-core = "poetry add 'typer[all]@latest'"
poetry-update-dev = "poetry add --group dev 'isort[toml]@latest' black@latest mypy@latest debugpy@latest ruff@latest poethepoet@latest"
poetry-update-test = "poetry add --group test pytest@latest pytest-cov@latest coverage@latest"
poetry-update-security = "poetry add --group security safety@latest 'bandit[toml]@latest'"
poetry-update-docs = "poetry add --group docs mkdocs@latest mkdocs-material@latest 'mkdocstrings[python]@latest'"
standard-update = "poetry self update && poetry update"
update = ["poetry-update-core", "poetry-update-dev", "poetry-update-test", "poetry-update-security", "poetry-update-docs"]
[tool.poetry.dependencies]
python = "^3.9"
pip = ">= 24.0"
typer = {extras = ["all"], version = ">=0.12.5,<0.16.0"}
[tool.poetry.group.test.dependencies]
pytest = "^8.3.3"
pytest-cov = "^5.0.0"
coverage = "^7.6.3"
[tool.poetry.group.dev.dependencies]
isort = {extras = ["toml"], version = "^5.13.2"}
black = "^24.10.0"
mypy = "^1.12.0"
debugpy = "^1.8.7"
ruff = ">=0.7,<0.9"
poethepoet = ">=0.29,<0.32"
[tool.poetry.group.security.dependencies]
safety = "^3.2.8"
bandit = {extras = ["toml"], version = "^1.7.10"}
[tool.poetry.group.docs.dependencies]
mkdocs = "^1.6.1"
mkdocs-material = "^9.5.41"
mkdocstrings = {extras = ["python"], version = "^0.26.2"}
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"