-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
242 lines (225 loc) · 6.2 KB
/
pyproject.toml
File metadata and controls
242 lines (225 loc) · 6.2 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
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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "python-template"
version = "0.0.0"
description = "A modern Python project template"
authors = [
{name = "Your Name", email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.13,<4.0"
dependencies = [
"typer>=0.12.0",
]
[project.optional-dependencies]
dev = [
# Linting and formatting
"ruff>=0.8.0",
# Type checking
"mypy>=1.12.0",
# Testing
"pytest>=8.4.0",
"pytest-cov>=6.0.0",
# Pre-commit hooks
"pre-commit>=4.0.0",
# Versioning and changelog
"commitizen>=3.13.0",
# Security
"pip-audit>=2.6.0",
"bandit>=1.7.0",
# Development utilities
"ipython>=8.30.0",
"tomli>=2.0.0",
# Documentation
"mkdocs>=1.6.1",
"mkdocs-material>=9.6.20",
"mkdocstrings[python]>=0.26.0",
]
[project.scripts]
python-template = "src.cli.main:cli"
[tool.hatch.build.targets.wheel]
packages = ["src"]
# UV configuration
[tool.uv]
# Index configuration for better performance
index-url = "https://pypi.org/simple"
# Use faster resolver
resolution = "highest"
# Cache packages globally for better performance
cache-dir = "~/.cache/uv"
# UV workspace configuration
[tool.uv.workspace]
members = []
# Ruff configuration
[tool.ruff]
target-version = "py313"
line-length = 88
indent-width = 2
# Performance optimizations
cache-dir = ".ruff_cache"
exclude = [
".git",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".venv",
"__pycache__",
"build",
"dist",
"*.egg-info",
"README.md",
"CHANGELOG.md",
"docs/",
"site/",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
"N", # pep8-naming
"S", # flake8-bandit (security)
"A", # flake8-builtins
"COM", # flake8-commas
"DTZ", # flake8-datetimez
"EM", # flake8-errmsg
"G", # flake8-logging-format
"PIE", # flake8-pie
"T20", # flake8-print
"TID", # flake8-tidy-imports
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PL", # pylint
"TRY", # tryceratops
"PERF", # perflint (performance)
"ICN", # flake8-import-conventions
"FURB", # refurb (modern Python)
]
ignore = [
"E501", # line too long, handled by formatter
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"PLR0913", # too many arguments
"PLR0912", # too many branches
"PLR0915", # too many statements
"PLR2004", # magic value used in comparison
"TRY003", # avoid specifying long messages outside exception class
"COM812", # missing trailing comma
"ISC001", # implicitly concatenated string literals
"Q000", # single quotes found but double quotes preferred
"Q001", # single quote multiline found but double quotes preferred
"Q002", # single quote docstring found but double quotes preferred
"Q003", # change outer quotes to avoid escaping inner quotes
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]
"tests/**/*.py" = [
"S101", # use of assert detected
"PLR2004", # magic value used in comparison
"ARG001", # unused function argument
"ARG002", # unused method argument
"ARG003", # unused class method argument
"ARG004", # unused static method argument
"ARG005", # unused lambda argument
]
"**/migrations/**/*.py" = ["ALL"]
"scripts/**/*.py" = ["T20"] # allow print statements in scripts
"init_project.py" = ["T20", "S603", "S607"] # allow print statements and subprocess calls in init script
[tool.ruff.lint.isort]
known-first-party = ["src"]
known-third-party = ["pytest", "uv", "typer", "ruff", "mypy"]
force-sort-within-sections = true
split-on-trailing-comma = true
combine-as-imports = true
force-single-line = false
# MyPy configuration
[tool.mypy]
python_version = "3.13"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false # More lenient for decorators
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
show_error_codes = true
# More lenient settings for better adoption
disallow_any_generics = false
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_any_unimported = false
disallow_any_expr = false
disallow_any_decorated = false
disallow_any_explicit = false
# Allow some flexibility
allow_redefinition = false
allow_untyped_globals = false
# Show more helpful information
show_column_numbers = true
show_error_context = true
pretty = true
color_output = true
error_summary = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = false
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "scripts.*"
disallow_untyped_defs = false
# Pytest configuration
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --strict-markers --strict-config"
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# Coverage configuration
[tool.coverage.run]
source = ["src"]
omit = ["*/tests/*", "*/test_*"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
# Commitizen configuration
[tool.commitizen]
name = "cz_conventional_commits"
version = "0.0.0"
version_scheme = "pep440"
tag_format = "v$version"
update_changelog_on_bump = true
changelog_file = "CHANGELOG.md"
version_files = [
"pyproject.toml:version",
"src/cli/__init__.py:__version__"
]