generated from MultifokalHirn/python_template_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
258 lines (237 loc) · 7.31 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
####################################################################################################
# ------------------------------------------- Project ------------------------------------------ #
####################################################################################################
[project]
name = "ornaments"
version = "0.0.0"
authors = [{name = "Lennard Wolf", email = "[email protected]"}]
description = """ \
Lorem ipsum dolor sit amet, consectetur adipiscing elit, \
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \
Ut enim ad minim veniam, quis nostrud exercitation ullamco \
laboris nisi ut aliquip ex ea commodo consequat.\
"""
keywords = ["template"]
license = {file = "LICENSE"}
maintainers = [{name = "Lennard Wolf", email = "[email protected]"}]
readme = {content-type = "text/markdown", file = "README.md"}
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"importlib-metadata",
"ruamel-yaml",
"termcolor",
"typing-extensions",
"devtools",
"pyboxen>=1.2.0",
]
requires-python = ">=3.11"
[project.optional-dependencies]
all = [
"pdm[refactoring,test,base,docs,lint]",
]
base = [
"pre-commit",
"commitizen",
]
docs = [
"furo",
"sphinx",
"sphinx-autodoc-typehints",
]
lint = [
"ruff>=0.1.8",
"mypy>=1.7.1",
"mypy-extensions",
]
refactoring = [
"pyupgrade>=3.15.0",
]
test = [
"covdefaults>=2.3",
"coverage-badge",
"coverage>=7.3.4",
"pytest-mypy",
"pytest-xdist",
"pytest>=7.4.3",
"types-mock",
]
[project.urls]
Changelog = "https://github.com/MultifokalHirn/ornaments/blob/main/CHANGELOG/"
Homepage = "https://github.com/MultifokalHirn/ornaments"
Repository = "https://github.com/MultifokalHirn/ornaments"
# Documentation = "https://"
[build-system]
build-backend = "pdm.backend"
requires = ["pdm-backend"]
####################################################################################################
# ------------------------------------------ SCRIPTS ------------------------------------------- #
####################################################################################################
[tool.pdm.scripts]
_.env_file = ".env"
# Dependency management
lock = {shell = """ \
pdm lock -G :all \
&& source .venv/bin/activate \
&& pdm sync \
"""}
update-all = {shell = """ \
printf 'Updating all dependencies...' \
&& pdm update -G :all \
&& printf '\t\t✅\n' \
"""}
# CI: format, lint, mypy, test
format = {shell = """ \
printf 'Formatting...' \
&& .venv/bin/ruff --config=./pyproject.toml --fix src/ tests/ docs/ \
&& printf '\t\t✅\n' \
"""}
lint = {shell = """ \
printf 'Linting...' \
&& .venv/bin/ruff check --config=./pyproject.toml src/ tests/ docs/ \
&& printf '\t\t✅\n' \
"""}
mypy = {shell = """ \
printf 'Type-checking...' \
&& .venv/bin/mypy --no-error-summary --install-types --config-file=./pyproject.toml \
&& printf '\t✅\n' \
"""}
test = {shell = """ \
printf 'Running tests...' \
&& .venv/bin/coverage run -m pytest tests/ --show-capture=log -p no:logging \
&& .venv/bin/coverage report \
&& .venv/bin/coverage-badge -o docs/img/coverage.svg -f \
"""}
ci = {shell = """ \
pdm run format \
; pdm run lint \
; pdm run mypy \
; pdm run test \
"""}
####################################################################################################
# -------------------------------------------- TOOLS ------------------------------------------- #
####################################################################################################
[tool.mypy]
# plugins = ["pydantic.mypy"]
disallow_any_unimported = false
ignore_missing_imports = true
pretty = true
# install_types = true # pre-commit has issues with this, so we use this as flag in the script
python_version = "3.11"
strict = true
warn_redundant_casts = true
warn_unused_ignores = false
files = ["src/**/*.py"]
exclude = ["tests/**/*.py", "docs/**/*.py"]
# [tool.pydantic-mypy]
# init_forbid_extra = true
# init_typed = true
# warn_required_dynamic_aliases = true
[tool.coverage.run]
source = ["src/ornaments"]
branch = true
# parallel = true
plugins = ["covdefaults"]
omit = [
"tests/*",
"docs/*",
"*/.venv/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if __name__ == .__main__.:",
"def __repr__",
"raise NotImplementedError",
]
fail_under = 80
omit = [
"tests/*",
"docs/*",
"*/.venv/*",
]
show_missing = true
skip_covered = false
sort = "Cover"
[tool.commitizen]
version = "0.0.0"
version_files = [
"src/ornaments/__version__.py",
"pyproject.toml:version",
]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
]
indent-width = 4
line-length = 127
# Assume Python 3.12
target-version = "py312"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
ignore = []
select = ["E4", "E7", "E9", "F"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
"INP001", # no implicit namespace
"D", # don"t care about documentation in tests
"S603", # `subprocess` call: check for execution of untrusted input
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
]
[tool.pdm]
# version = {from = "src/ornaments/__init__.py"}
[tool.pdm.build]
excludes = ["./**/.git"]
includes = ["src/**/*", "pyproject.toml", "LICENSE", "README.md"]
package-dir = "src"
source-includes = ["tests", "CHANGELOG.md", "LICENSE", "README.md"]
[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::ornaments._warnings.CalledTooOftenWarning",
]
# cov = ["src/ornaments"]
# addopts = "--cov=ornaments --cov-report html"