Repository navigation
Expand file tree
/
Copy pathpyproject.toml.jinja
More file actions
242 lines (218 loc) · 6.42 KB
/
Copy pathpyproject.toml.jinja
File metadata and controls
242 lines (218 loc) · 6.42 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",
"hatch-cpp{% if add_c_abi %}>=0.6.0{% elif add_pyodide %}>=0.5.0{% endif %}",
"pybind11",
]
build-backend = "hatchling.build"
[project]
name = "{{ project_name_formatted }}"
authors = [
{name = "{{ team }}", email = "{{ email }}"},
]
description = "{{ project_description }}"
readme = "README.md"
license = { text = "Apache-2.0" }
version = "0.1.0"
requires-python = ">={{ python_version_primary }}"
keywords = []
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3",
{% if python_version_primary == "3.10" -%}
"Programming Language :: Python :: 3.10",
{% endif -%}
{% if python_version_primary in ["3.10", "3.11"] -%}
"Programming Language :: Python :: 3.11",
{% endif -%}
{% if python_version_primary in ["3.10", "3.11", "3.12"] -%}
"Programming Language :: Python :: 3.12",
{% endif -%}
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dependencies = []
[project.optional-dependencies]
develop = [
"build",
"bump-my-version",
"check-dist",
"cibuildwheel",
"codespell",
"hatch-cpp{% if add_c_abi %}>=0.6.0{% elif add_pyodide %}>=0.5.0{% endif %}",
"hatchling",
"mdformat",
"mdformat-myst",
"mdformat-tables>=1",
"pybind11",
"pytest",
"pytest-cov",
"ruff",
"twine",
"ty",
"uv",
"wheel",
]
[project.scripts]
[project.urls]
Repository = "https://github.com/{{ github }}/{{ project_name_formatted }}"
Homepage = "https://github.com/{{ github }}/{{ project_name_formatted }}"
[tool.bumpversion]
current_version = "0.1.0"
commit = true
tag = true
commit_args = "-s"
[[tool.bumpversion.files]]
filename = "{{ module }}/__init__.py"
search = '__version__ = "{current_version}"'
replace = '__version__ = "{new_version}"'
[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = 'version = "{current_version}"'
replace = 'version = "{new_version}"'
{% if add_c_abi %}
[[tool.bumpversion.files]]
filename = "cpp/CMakeLists.txt"
search = "VERSION {current_version}"
replace = "VERSION {new_version}"
{% endif %}
[tool.cibuildwheel]
build = "{% if python_version_primary == '3.10' %}cp310-* {% endif %}{% if python_version_primary in ['3.10', '3.11'] %}cp311-* {% endif %}{% if python_version_primary in ['3.10', '3.11', '3.12'] %}cp312-* {% endif %}cp313-*"
test-command = "pytest -vvv {project}/{{ module }}/tests"
test-extras = "develop"
[tool.cibuildwheel.linux]
manylinux-aarch64-image = "manylinux_2_28"
manylinux-x86_64-image = "manylinux_2_28"
skip = "*i686* *musllinux*"
{% if add_c_abi -%}
# Keep the bundled C ABI library where the extension's rpath expects it.
repair-wheel-command = "auditwheel repair --exclude 'lib{{ module }}.so' -w {dest_dir} {wheel}"
{% endif %}
[tool.cibuildwheel.macos]
environment = {MACOSX_DEPLOYMENT_TARGET="11.0"}
archs = "arm64"
{% if add_c_abi -%}
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} --exclude lib{{ module }}.dylib -w {dest_dir} -v {wheel}"
{% endif %}
[tool.cibuildwheel.windows]
archs = "AMD64"
skip = "*win32 *arm64"
{% if add_c_abi -%}
# The C ABI library ships inside the wheel; delvewheel must not look for it on PATH.
repair-wheel-command = "delvewheel repair --exclude lib{{ module }}.dll -w {dest_dir} {wheel}"
{% endif %}
{% if add_pyodide -%}
[tool.cibuildwheel.pyodide]
test-command = "python -m pytest -vvv --pyargs {{ module }}.tests"
test-extras = []
test-requires = ["pytest"]
{% if add_c_abi -%}
# Emscripten has no shared libraries to split; compile the library in.
environment = {HATCH_CPP_LIBRARY_SOURCE="direct"}
{% endif -%}
{% endif %}
[tool.coverage.run]
branch = true
omit = [
"{{ module }}/tests/integration/*",
]
[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 50
[tool.hatch.build.sources]
src = "/"
[tool.hatch.build.hooks.hatch-cpp]
verbose = true
{%- if add_c_abi %}
# lib{{ module }}: the C ABI library, shipped under {{ module }}/lib. Its header is in {{ module }}/include.
[[tool.hatch.build.hooks.hatch-cpp.libraries]]
name = "{{ module }}/lib/lib{{ module }}"
sources = ["cpp/{{ project_name_formatted }}/c_api.cpp", "cpp/{{ project_name_formatted }}/example.cpp"]
include-dirs = ["cpp", "{{ module }}/include"]
binding = "generic"
define-macros = ["{{ module | upper }}_BUILD"]
extra-compile-args-linux = ["-fvisibility=hidden"]
extra-compile-args-darwin = ["-fvisibility=hidden"]
expected-headers = ["{{ module }}/include/{{ module }}/{{ module }}.h"]
header-symbol-prefix = "{{ module }}_"
expected-abi-strings = ["{{ module | upper }}_ABI_VERSION 1"]
# The pybind11 extension, linked against the library by default (library-source = bundled).
[[tool.hatch.build.hooks.hatch-cpp.libraries]]
name = "{{ module }}/extension"
sources = ["cpp/python/extension.cpp"]
include-dirs = ["{{ module }}/include"]
binding = "pybind11"
depends = ["{{ module }}/lib/lib{{ module }}"]
{%- else %}
libraries = [
{name = "{{ module }}/extension", sources = ["cpp/{{ project_name_formatted }}/extension.cpp"], include-dirs = ["cpp"], binding="pybind11"}
]
{%- endif %}
[tool.hatch.build.targets.sdist]
exclude = ["*.dll", "*.dylib", "*.so", "*.pyd"]
packages = [
"{{ module }}",
"cpp",
]
{% if add_vcpkg %}
[tool.hatch.build.targets.sdist.force-include]
"vcpkg.json" = "vcpkg.json"
"vcpkg-overlays" = "vcpkg-overlays"
{% endif %}
[tool.hatch.build.targets.wheel]
artifacts = [
"{{ module }}/*.dll",
"{{ module }}/*.dylib",
"{{ module }}/*.so",
{%- if add_c_abi %}
"{{ module }}/lib/*",
{%- endif %}
]
packages = [
"{{ module }}",
]
[tool.pytest.ini_options]
addopts = [
"-vvv",
"--junitxml=junit.xml",
]
testpaths = "{{ module }}/tests"
[tool.ruff]
line-length = 150
[tool.ruff.lint]
extend-select = [
"I",
]
[tool.ruff.lint.isort]
combine-as-imports = true
default-section = "third-party"
known-first-party = [
"{{ module }}",
]
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401",
"F403",
]
{%- if add_docs %}
[tool.yardang]
title = "{{ project_name }}"
root = "README.md"
pages = []
use-autoapi = true
{% endif %}