-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
202 lines (178 loc) · 5.45 KB
/
pyproject.toml
File metadata and controls
202 lines (178 loc) · 5.45 KB
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
[project]
name = "python_project_template"
version = "0.0.9"
description = "Copier template repository for generating uv-first Python projects."
readme = "README.md"
requires-python = ">=3.11"
license = { text = "MIT" }
keywords = ["python", "template", "copier", "uv", "ruff"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Typing :: Typed",
]
dependencies = [] # Runtime dependencies go here
[project.optional-dependencies]
dev = [
"copier>=9.11.2",
"jinja2-time>=0.2.0",
"ruff>=0.8.0",
"basedpyright>=1.21.0",
"pre-commit>=4.0.0",
"typing-extensions>=4.12.0",
"detect-secrets>=1.5.0",
"commitizen>=4.0.0",
]
test = [
"pytest>=8.0.0",
"pytest-asyncio>=0.24.0",
"pytest-xdist>=3.5.0",
"pytest-cov>=6.0.0",
"coverage[toml]>=7.6.0",
"pytest-testmon>=2.2.0",
]
[dependency-groups]
changelog = [
"git-cliff>=2.6.0",
]
[project.urls]
Homepage = "https://github.com/buddingengineers12345/python_project_template"
Documentation = "https://github.com/buddingengineers12345/python_project_template#readme"
Repository = "https://github.com/buddingengineers12345/python_project_template"
Issues = "https://github.com/buddingengineers12345/python_project_template/issues"
# ==========================================================================
# Ruff Configuration
# ==========================================================================
[tool.ruff]
line-length = 100
target-version = "py311"
src = ["scripts", "tests"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
docstring-code-format = true
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"C4", # flake8-comprehensions
"RUF", # ruff-specific rules
"TCH", # flake8-type-checking
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"ARG", # flake8-unused-arguments
"D", # pydocstyle — enforce Google-style docstrings
"C90", # McCabe complexity
"PERF", # perflint — catch performance anti-patterns
"T20", # flake8-print — discourage print() in non-test code
]
# E501 is intentionally ignored — line length is enforced by ruff format, not ruff check
ignore = [
"E501",
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ARG", "T20"] # print() OK in tests; unused args OK (fixtures); D enforced
"scripts/**" = ["T20"] # CLI scripts may use print(); docstrings enforced (D)
[tool.ruff.lint.isort]
known-first-party = ["scripts"]
# ==========================================================================
# BasedPyright Configuration
# ==========================================================================
[tool.basedpyright]
pythonVersion = "3.11"
typeCheckingMode = "standard"
include = ["scripts", "tests"]
exclude = [
"**/__pycache__",
"**/.*",
"build",
"dist",
]
venvPath = "."
venv = ".venv"
reportImplicitOverride = false
reportMissingImports = true
reportMissingTypeStubs = false
reportUnknownMemberType = false
reportUnknownArgumentType = false
reportUnknownVariableType = false
# ==========================================================================
# Pytest Configuration
# ==========================================================================
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = ["tests"]
pythonpath = ["."] # "." exposes scripts/
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-q",
"--strict-markers",
"--strict-config",
"--tb=short",
"--log-level=WARNING",
"-ra",
"--testmon",
]
markers = [
"e2e: End-to-end tests across the full stack or external systems",
"integration: Tests crossing module boundaries, real I/O, subprocesses, or services",
"regression: Guards a fixed bug or ticket-specific behaviour from returning",
"slow: Routinely exceeds ~1s; excluded from default runs (override with -m slow)",
"smoke: Minimal deploy or health checks on critical paths",
"unit: Fast isolated tests with boundaries mocked or in-process only",
]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning",
]
# ==========================================================================
# Coverage Configuration
# ==========================================================================
[tool.coverage.run]
branch = true
source = ["scripts"]
omit = [
"tests/*",
"**/__init__.py",
"*/tests/*",
"*/__pycache__/*",
]
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
fail_under = 85
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
"@overload",
]
[tool.coverage.xml]
output = "coverage.xml"
[tool.coverage.html]
directory = "htmlcov"
# Commitizen: conventional commits (`cz commit`), commit-msg validation via pre-commit.
# version_provider = "pep621" means commitizen reads/writes [project].version — no duplicate.
[tool.commitizen]
name = "cz_conventional_commits"
version_provider = "pep621"
tag_format = "v$version"