-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathpyproject.toml.jinja
More file actions
191 lines (174 loc) · 5.03 KB
/
pyproject.toml.jinja
File metadata and controls
191 lines (174 loc) · 5.03 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
# see documentation, e.g.
# - https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata
# - https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
# - https://www.python.org/dev/peps/pep-0621/
[build-system]
requires = ["setuptools>=77.0.3", "setuptools-scm", "wheel"]
build-backend = "setuptools.build_meta"
[project]
authors = [
{ name = "{{ full_name|replace('\"', '\\\"') }}", email = "{{ email }}" }
]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = []
description = "{{ package_short_description|replace('\"', '\\\"') }}"
keywords = [
{%- for item in keywords.split(',') -%}
"{{ item }}"{{ "," if not loop.last }}
{%- endfor -%}
]
{% if license != "Other" -%}
license = "{{ {'Apachev2': 'Apache-2.0',
'MIT': 'MIT',
'BSD': 'BSD-3-Clause',
'ISC': 'ISC',
'GNUv3': 'GPL-3.0-or-later',
'GNULesserv3': 'LGPL-3.0-or-later',
}[license] }}"
{% endif -%}
{#- NOTICE file is only present for Apache -#}
license-files = ["LICENSE"{% if license == "Apachev2" %}, "NOTICE"{% endif %}]
name = "{{ package_name }}"
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.12"
version = "{{ version }}"
[dependency-groups]
dev = [
"build", # build is not only used in publishing (below), but also in the template's test suite
"bump-my-version",
{%- if AddLocalTests %}
"coverage [toml]",
"pytest",
"pytest-cov",
{%- endif %}
"ruff",
{%- if AddLocalDocumentation %}
"sphinx",
"sphinx_rtd_theme",
"sphinx-autoapi",
{%- endif %}
"tox",
"myst_parser",
{% if AddTyping and SelectTypeChecker -%}
"{{ SelectTypeChecker }}",
{%- endif %}
{%- if AddTypingInDocs %}
"sphinx-autodoc-typehints",
{%- endif %}
]
{%- if AddLocalDocumentation %}
docs = [
"sphinx",
"sphinx_rtd_theme",
"sphinx-autoapi",
"myst_parser",
{%- if AddTypingInDocs %}
"sphinx-autodoc-typehints",
{%- endif %}
]
{%- endif %}
publishing = [
"build",
"twine",
"wheel",
]
[project.urls]
Repository = "{{ repository_url }}"
Issues = "{{ repository_url }}/issues"
{% if AddChangeLog -%}
Changelog = "{{ repository_url }}/CHANGELOG.md"
{% endif -%}
{% if AddOnlineDocumentation -%}
Documentation = "https://{{ package_name }}.readthedocs.io"
{% endif %}
{% if AddLocalTests -%}
[tool.pytest.ini_options]
testpaths = ["tests"]
{% endif %}
{% if AddLocalTests -%}
[tool.coverage.run]
branch = true
source = ["src/{{ package_name }}"]
command_line = "-m pytest"
{%- endif %}
[tool.tox]
requires = ["tox>=4.22"]
env_list = [ "py312", "py313", "py314" ]
skip_missing_interpreters = true
{% if AddLocalTests -%}
[tool.box.testenv]
description = "Run test under {base_python}"
commands = [["pytest"]]
[tool.tox.env_run_base]
dependency_groups = [ "dev" ]
{%- endif %}
[tool.ruff]
line-length = 79
output-format = "concise"
{%- if AddLocalDocumentation %}
extend-exclude = ["docs"]
{%- endif %}
[tool.ruff.lint]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Enable Pyflakes `E` and `F` codes by default.
select = ["ALL"]
ignore = [
"ANN204", # Missing return type annotation for special (dunder) method
"FBT", # Using boolean function arguments
"TD", # TODOs
"FIX001", # Resolve FIXMEs
"FIX002", # Resolve TODOs
"B028", # No explicit `stacklevel` keyword argument found in warning
"COM812", # Trailing commas are taken care of by `ruff format`
# No docstrings required in the following cases
"D100", # Missing module docstring
"D104", # Missing public package docstring
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
]
pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores]
# Tests can ignore a few extra rules
"tests/**.py" = [
"ANN201", # Missing return type annotation for public function
"PT011", # Missing `match` parameter in `pytest.raises()`
"S101", # Use of assert is detected
]
[tool.ruff.lint.isort]
known-first-party = ["{{ package_name }}"]
force-single-line = true
no-lines-before = ["future","standard-library","third-party","first-party","local-folder"]
{% if AddTyping -%}
{% if SelectTypeChecker == 'pyright' -%}
[tool.pyright]
include = ["src"]
{%- endif %}
{% if SelectTypeChecker == 'mypy' -%}
[tool.mypy]
files = ["src"]
{%- endif %}
{%- endif %}
[tool.bumpversion]
current_version = "{{ version }}"
[[tool.bumpversion.files]]
filename = "src/{{ package_name }}/__init__.py"
[[tool.bumpversion.files]]
filename = "pyproject.toml"
{% if AddCitation -%}
[[tool.bumpversion.files]]
filename = "CITATION.cff"
{%- endif %}
{% if AddLocalDocumentation -%}
[[tool.bumpversion.files]]
filename = "docs/conf.py"
{%- endif %}