-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
281 lines (248 loc) · 7.93 KB
/
pyproject.toml
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# TODO: work out how to do this well (https://gitlab.com/magicc/copier-fgen-based-repository/-/issues/1)
[project]
name = "fgen-example"
version = "0.3.2a0"
description = "Example project using fgen to wrap a simple module"
readme = "README.md"
authors = [{name = "Jared Lewis, email = [email protected]"}]
# TODO: This appears to not be used. The docs I looked at were
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
# via https://scikit-build-core.readthedocs.io/en/latest/getting_started.html#python-package-configuration
# (https://gitlab.com/magicc/copier-fgen-based-repository/-/issues/1)
packages = [{include = "fgen_example", from = "src"}]
requires-python = ">=3.10"
dependencies = [
"pint >= 0.22",
"numpy <= 2.0.0",
"fgen == 0.6.0",
]
[tool.poetry]
name = "fgen-example"
version = "0.3.2a0"
description = "Example project using fgen to wrap a simple module"
readme = "README.md"
authors = ["Jared Lewis <[email protected]>"]
packages = [{include = "fgen_example", from = "src"}]
# The real project dependencies are not managed here
# TODO: remove once #1 is resolved and poetry@2 is released
[tool.poetry.dependencies]
python = "^3.9"
[tool.poetry.group.tests.dependencies]
pytest = "^7.3.1"
[tool.poetry.group.docs.dependencies]
myst-nb = "^0.17.0"
sphinx-rtd-theme = "^1.2.0"
sphinx-autodoc-typehints = "^1.23.0"
sphinx-autodocgen = "^1.3"
jupytext = "^1.14.5"
sphinx-copybutton = "^0.5.2"
[tool.poetry.group.dev.dependencies]
pytest-cov = "^4.0.0"
coverage = "^7.2.0"
black = "23.3.0"
blackdoc = "0.3.8"
mypy = "^1.2.0"
ruff = "0.0.264"
pre-commit = "^3.3.1"
towncrier = "^23.6.0"
liccheck = "^0.9.1"
cmakelang = "^0.6.13"
[build-system]
requires = ["scikit-build-core", "numpy>=2.0.0", "fgen[templates]==0.6.0"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
cmake.verbose = true
logging.level = "DEBUG"
ninja.minimum-version = "1.10"
cmake.minimum-version = "3.17.2"
build-dir = "build"
[tool.scikit-build.cmake.define]
# TODO: docs for what is going on here (https://gitlab.com/magicc/copier-fgen-based-repository/-/issues/6)
# Need to point to this more flexibly, although
# these defaults can be overridden using the `CMAKE_ARGS` environment variable.
# See https://scikit-build-core.readthedocs.io/en/latest/configuration.html#configuring-cmake-arguments-and-defines
# This needs to match what is fed to `fgen generate`
# Should we set this from some environment variable or other thing so it can also be
# shared with the Makefile?
EXTENSION_MODULE_NAME = "_lib"
# Set this from some environment variable so it can also be shared
# with the Makefile?
# Always including a submodule will make the pyproject.toml and CMakeLists.txt
# auto-generation process more complicated. We could also just not support this
# pattern?
EXTENSION_SUBMODULE_NAME = "_libsubmodule"
[tool.coverage.run]
source = ["src"]
branch = true
[tool.coverage.report]
fail_under = 50
skip_empty = true
show_missing = true
# Regexes for lines to exclude from consideration in addition to the defaults
exclude_also = [
# Don't complain about missing type checking code:
"if TYPE_CHECKING",
]
[tool.mypy]
strict = true
# prevent unimported libraries silently being treated as Any
disallow_any_unimported = true
# show error codes on failure with context
show_error_codes = true
show_error_context = true
# warn if code can't be reached
warn_unreachable = true
# importing following uses default settings
follow_imports = "normal"
[tool.jupytext]
formats = "ipynb,py:percent"
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
]
[tool.ruff]
src = ["src"]
target-version = "py39"
select = [
"E", # pycodestyle error
"W", # pycodestyle warning
"F", # pyflakes
"I", # isort
"D", # pydocstyle
"PL", # pylint
"TRY", # tryceratops
"NPY", # numpy rules
"RUF", # ruff specifics
"UP", # pyupgrade
"S", # flake8-bandit
# pandas support via pandas-vet. In some cases we will want to disable
# this because it can lead to too many false positives.
"PD",
]
unfixable = [
"PD002", # Disable autofix for inplace as this often introduces bugs
]
ignore = [
"D105", # Missing docstring in magic method
"D200", # One-line docstring should fit on one line with quotes
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
]
# Provide some leeway for long docstring, this is otherwise handled by black
line-length = 110
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.per-file-ignores]
"test*.py" = [
"D", # Documentation not needed in tests
"S101", # S101 Use of `assert` detected
"PLR2004" # Magic value used in comparison
]
"docs/source/notebooks/*" = [
"D100", # Missing docstring at the top of file
"E402", # Module level import not at top of file
"S101", # Use of `assert` detected
]
"scripts/*" = [
"S101" # S101 Use of `assert` detected
]
[tool.ruff.isort]
known-first-party = ["fgen_example"]
[tool.ruff.pydocstyle]
convention = "numpy"
[tool.towncrier]
package = "fgen_example"
package_dir = "src"
filename = "docs/source/changelog.md"
directory = "changelog/"
title_format = "## fgen_example {version} ({project_date})"
underlines = ["", "", ""]
issue_format = "[#{issue}](https://github.com/lewisjared/fgen-example/pulls/{issue})"
[[tool.towncrier.type]]
directory = "breaking"
name = "Breaking Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "improvement"
name = "Improvements"
showcontent = true
[[tool.towncrier.type]]
directory = "fix"
name = "Bug Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "docs"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "trivial"
name = "Trivial/Internal Changes"
showcontent = false
[tool.liccheck]
authorized_licenses = [
"bsd",
"bsd license",
"BSD 3-Clause",
"CC0",
"apache",
"apache 2.0",
"apache software",
"apache software license",
"Apache License, Version 2.0",
"Historical Permission Notice and Disclaimer (HPND)",
"isc license",
"isc license (iscl)",
"gnu lgpl",
"lgpl with exceptions or zpl",
"LGPLv2+",
"GNU Lesser General Public License v2 (LGPLv2)",
"GNU Lesser General Public License v2 or later (LGPLv2+)",
"mit",
"mit license",
"Mozilla Public License 2.0 (MPL 2.0)",
"python software foundation",
"python software foundation license",
"zpl 2.1",
]
# This starting list is relatively conservative. Depending on the project, it
# may make sense to move some of these into the authorized list
unauthorized_licenses = [
"agpl",
"gnu agpl",
"gpl v3",
"gplv3",
"gpl v2",
"gplv2",
"gpl v1",
"gplv1",
]
[tool.cibuildwheel]
before-all = "uname -a"
before-build = "rm -rf {project}/build"
# Specify the builds that will be performed
# See https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip for the list of build targets.
# Skipping
# - CPython 3.6 - 3.9: EOLed
# - All pypy builds: Not used
# - i686, s390x and ppc64le archs: Not used/supported
# - musllinux (alpine): not supported
build = "cp310* cp311* cp312*"
skip = "pp* *_i686 *_ppc64le *_s390x *-musllinux_*"
# Use manylinux version 2.28 for manylinux instances (except i686 which doesn't have a 2.28 image)
# This effectively sets the version of gfortran that is used (GCC 12)
# ALT Linux 10+, RHEL 9+, Debian 11+, Fedora 34+, Mageia 8+, Photon OS 3.0 with updates, Ubuntu 21.04+
manylinux-aarch64-image = "manylinux_2_28"
manylinux-x86_64-image = "manylinux_2_28"
# Testing
test-command = "python -c 'from fgen_example.derived_type import DerivedType; print(DerivedType.from_new_connection())'"
[tool.cibuildwheel.windows]
before-all = ""
before-build = ""