Skip to content

Commit fb74945

Browse files
Add project/pyproject.toml.j2 template
1 parent 8700f78 commit fb74945

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed

project/pyproject.toml.j2

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
[project]
2+
name = "{{ python_package_distribution_name }}"
3+
version = "0.1.0"
4+
description = "{{ project_description }}"
5+
authors = [
6+
{name = "{{ author_fullname }}", email = "{{ author_email }}"}
7+
]
8+
license = "{{ copyright_license }}"
9+
10+
requires-python = ">=3.11,<3.13"
11+
12+
dependencies = []
13+
14+
[project.optional-dependencies]
15+
dev = [
16+
"argcomplete<4.0.0,>=3.5.0",
17+
"deptry<1.0.0,>=0.23.0",
18+
"icecream<3.0.0,>=2.1.3",
19+
"ipython<9.0.0,>=8.27.0",
20+
"mypy<2.0.0,>=1.14.1",
21+
"pyclean<4.0.0,>=3.0.0",
22+
"pytest-asyncio<1.0.0,>=0.25.2",
23+
"pytest-cov<7.0.0,>=6.0.0",
24+
"pytest<9.0.0,>=8.3.4",
25+
"rich<14.0.0,>=13.8.1",
26+
"ruff>=0.9.5",
27+
]
28+
test = [
29+
"coverage<8.0.0,>=7.6.1",
30+
"hypothesis[cli]<7.0.0,>=6.112.1",
31+
"pytest<9.0.0,>=8.3.3",
32+
"pytest-asyncio<1.0.0,>=0.24.0",
33+
"pytest-cov>=6.1.1",
34+
"pytest-datafiles<4.0.0,>=3.0.0",
35+
"pytest-xdist<4.0.0,>=3.6.1",
36+
]
37+
38+
{% if python_package_command_line_name %}
39+
[project.scripts]
40+
{{ python_package_command_line_name }} = "{{ python_package_import_name }}.cli:main"
41+
{% endif %}
42+
43+
[tool.deptry]
44+
# DEP003: transitive deps
45+
ignore = [
46+
"DEP003"
47+
]
48+
49+
[tool.deptry.per_rule_ignores]
50+
# DEP002: not used in codebase (excluding dev deps)
51+
DEP002 = [
52+
"deptry",
53+
"mypy",
54+
"pytest",
55+
"pytest-asyncio",
56+
"pytest-cov",
57+
"ruff",
58+
"uvicorn"
59+
]
60+
61+
[tool.mypy]
62+
python_version = "3.11"
63+
warn_return_any = true
64+
warn_unused_configs = true
65+
disallow_untyped_defs = true
66+
check_untyped_defs = true
67+
68+
[tool.pytest.ini_options]
69+
testpaths = ["tests"]
70+
python_files = "test_*.py"
71+
python_functions = "test_*"
72+
python_classes = "Test*"
73+
asyncio_mode = "auto"
74+
markers = [
75+
"unit: marks tests as unit tests",
76+
"integration: marks tests as integration tests",
77+
"e2e: marks tests as end-to-end tests",
78+
"benchmark: marks performance benchmark tests"
79+
]
80+
81+
[tool.coverage.run]
82+
source = ["{{ python_package_import_name }}"]
83+
omit = [
84+
"*/tests/*",
85+
"*/migrations/*",
86+
"*/alembic/*"
87+
]
88+
89+
[tool.coverage.report]
90+
exclude_lines = [
91+
"pragma: no cover",
92+
"def __repr__",
93+
"raise NotImplementedError",
94+
"if TYPE_CHECKING:",
95+
"pass",
96+
"..."
97+
]
98+
99+
[tool.ruff]
100+
# Fix without reporting on leftover violations
101+
fix-only = true
102+
103+
# Enumerate all fixed violations
104+
show-fixes = true
105+
106+
# Indent width (default: 4)
107+
indent-width = 4
108+
109+
# Black (default: 88)
110+
line-length = 130
111+
112+
# Exclude a variety of commonly ignored directories.
113+
exclude = [
114+
".bzr",
115+
".direnv",
116+
"dist",
117+
".eggs",
118+
".git",
119+
".git-rewrite",
120+
".hg",
121+
".mypy_cache",
122+
".nox",
123+
".pants.d",
124+
"__pycache__",
125+
".pytype",
126+
".ruff_cache",
127+
".svn",
128+
".tox",
129+
".venv",
130+
"__pypackages__",
131+
"_build",
132+
"buck-out",
133+
"build",
134+
"dist",
135+
"node_modules",
136+
"venv",
137+
]
138+
139+
# Assume Python 3.11
140+
target-version = "py311"
141+
142+
[tool.ruff.format]
143+
# Use spaces instead of tabs
144+
indent-style = "space"
145+
146+
# Use `\n` line endings for all files
147+
line-ending = "lf"
148+
149+
# Set quote style for strings
150+
quote-style = "preserve"
151+
152+
[tool.ruff.lint]
153+
select = [
154+
# pycodestyle
155+
"E",
156+
# Pyflakes
157+
"F",
158+
# pyupgrade
159+
"UP",
160+
# flake8-bugbear
161+
"B",
162+
# flake8-simplify
163+
"SIM",
164+
# isort
165+
"I",
166+
]
167+
ignore = ["D203", "E203", "E251", "E266", "E401", "E402", "E501", "F401", "F403", "F841"]
168+
169+
# Allow unused variables when underscore-prefixed.
170+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
171+
172+
# Allow autofix for all enabled rules (when `--fix`) is provided.
173+
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TID", "TRY", "UP", "YTT"]
174+
175+
# unfixable = []
176+
177+
[tool.ruff.lint.isort]
178+
combine-as-imports = true
179+
from-first = false
180+
no-sections = true
181+
order-by-type = true
182+
183+
[tool.ruff.lint.flake8-quotes]
184+
docstring-quotes = "double"
185+
186+
[tool.ruff.lint.mccabe]
187+
# Unlike Flake8, default to a complexity level of 10.
188+
max-complexity = 10

0 commit comments

Comments
 (0)