-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
287 lines (251 loc) · 9.08 KB
/
Copy pathpyproject.toml
File metadata and controls
287 lines (251 loc) · 9.08 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
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
282
283
284
285
286
287
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools >= 61.0.0",
"versioneer[toml]==0.29",
]
[project]
name = "xrexpr"
description = "Rewrite chained expressions on xarray datasets to improve performance"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{ name = "Charle Turner", email = "charles.turner@anu.edu.au"},
]
maintainers = [
{ name = "Charle Turner", email = "charles.turner@anu.edu.au"},
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
]
license = {text = "Apache Software License 2.0"}
dependencies = [
"frozendict",
"packaging", # Version() gates the pre-2026.4.0 scan-coord bug in schema.py
"typing_extensions", # assert_never on the 3.10 floor (typing.assert_never is 3.11+)
"xarray"
]
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"black", # formatting
"coverage", # testing
"dask", # testing: rechunk rewrites need a chunk manager to replay
"hypothesis", # testing (property-based)
"mypy", # linting
"numbagg", # testing: xarray's rolling_exp refuses to run without it
"pytest", # testing
"ruff", # linting
"xarray",
]
# Declared once, consumed twice: pixi exposes every optional-dependency group as a
# feature of the same name (which is how the ``dev`` extra above and
# ``[tool.pixi.feature.dev]`` below merge), and Read the Docs installs ``.[docs]`` with
# pip. Adding a docs dependency here reaches both without a second list to keep in step.
docs = [
"sphinx>=8",
"myst-nb>=1.2", # MyST pages *and* executed code cells; it bundles myst-parser
"pydata-sphinx-theme>=0.16",
"sphinx-design", # landing-page cards
"sphinx-copybutton",
"sphinxcontrib-mermaid>=1.0", # MyST has no native mermaid
"ipykernel", # myst-nb executes pages through a Jupyter kernel
"dask", # docs-only, same posture as the test feature: the rechunking pages call
# .chunk(), while xrexpr itself stays dask-free
]
[project.scripts]
[project.urls]
bugs = "https://github.com/charles-turner-1/xrexpr/issues"
changelog = "https://github.com/charles-turner-1/xrexpr/blob/main/CHANGELOG.md"
homepage = "https://github.com/charles-turner-1/xrexpr"
[tool.setuptools]
package-dir = {"" = "src"}
[tool.setuptools.package-data]
"*" = ["*.*"]
# Mypy
# ----
[tool.mypy]
files = "src"
exclude = [
"src/xrexpr/_version.py",
]
# Use strict defaults
strict = true
warn_unreachable = true
# warn_unused_ignores = true
warn_no_return = true
allow_subclassing_any = true
[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "src/xrexpr/_version.py"
versionfile_build = "xrexpr/_version.py"
tag_prefix = "v"
parentdir_prefix = "xrexpr-"
[tool.coverage.run]
omit = [
"*/_version.py",
"*/data/__init__.py",
]
[tool.ruff]
target-version = "py310"
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"versioneer.py",
"_version.py",
"tests"
]
[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# D105: magic methods (``__repr__``, ``__getitem__``) carry their meaning in the name
# D205: a summary line followed by a blank line, but multi-sentence summaries here
# deliberately wrap -- black owns the wrapping, so this would fight it
ignore = [
"E402",
"E501",
"D105",
"D205",
]
select = [
# Pyflakes
"F",
# Pycodestyle
"E",
"W",
# isort
"I",
# Pyupgrade
"UP",
# pydocstyle -- NumPy-style docstrings (see [tool.ruff.lint.pydocstyle])
"D",
]
[tool.ruff.lint.per-file-ignores]
# Every test now carries a NumPy-style docstring stating the scenario it pins (see
# ``planning/roadmap/00-assessment.md``), so the suite is linted like the rest of the code --
# except D401: a test's summary states the scenario declaratively ("A select hops in front
# of..."), not as an imperative instruction, which is what D401 expects of a function.
"tests/**" = ["D401"]
[tool.ruff.lint.pydocstyle]
# NumPy docstring convention (numpydoc): ``Parameters``/``Returns``/``Raises``/``Notes``
# sections, underlined with dashes. Selecting it here also switches off the rules that
# contradict it (D203, D212, D213, D402, D413, D415, D416, D417).
convention = "numpy"
[tool.ruff.lint.mccabe]
max-complexity = 18
[tool.ruff.lint.isort]
known-first-party = ["xrexpr"]
[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
# Hypothesis's own end-of-run report: per-property example counts, how many were
# discarded by ``assume``, and how long generation took.
addopts = "--hypothesis-show-statistics"
[tool.pixi.workspace]
channels = ["conda-forge"]
name = "xrexpr"
platforms = ["osx-arm64", "linux-64", "win-64"]
[tool.pixi.dependencies]
python = ">=3.10"
xarray = "*"
frozendict = "*"
packaging = "*"
typing_extensions = "*"
versioneer = ">=0.29,<0.30"
[tool.pixi.pypi-dependencies]
xrexpr = {editable = true, path = "."}
[tool.pixi.environments]
default = { features = ["dev", "test", "numbagg"], solve-group = "default" }
test-py310 = { features = ["py310", "test", "numbagg"] }
test-py311 = { features = ["py311", "test", "numbagg"] }
test-py312 = { features = ["py312", "test", "numbagg"] }
test-py313 = { features = ["py313", "test", "numbagg"] }
test-numbagg = { features = ["test", "numbagg"] }
test-nonumbagg = { features = ["test"] }
# ``solve-group = "default"`` so the docs build against the same xarray the tests do.
# Deliberately absent: numbagg. xarray dispatches reductions to it when it is importable
# and its presence changes results, not just coverage (see the CI matrix comment), so the
# docs env is the no-numbagg arm and executed output has one canonical form.
docs = { features = ["docs"], solve-group = "default" }
[tool.pixi.feature.test.dependencies]
pytest = ">=8.4.2,<9"
coverage = "*"
hypothesis = "*"
# not a runtime dependency: xrexpr must keep working dask-free. The rechunk tests
# skip themselves without it (``pytest.importorskip``).
dask = "*"
[tool.pixi.feature.numbagg.dependencies]
numbagg = "*"
[tool.pixi.feature.test.tasks]
test = { cmd = "pytest tests", description = "Run tests" }
test-cov = { cmd = "coverage run -m --source=xrexpr pytest tests && coverage xml", description = "Run tests with coverage and generate xml report" }
[tool.pixi.feature.dev.dependencies]
pre-commit = ">=4.2.0,<5"
ruff = "*"
black = "*"
mypy = "*"
[tool.pixi.feature.dev.tasks]
ruff = { cmd = "ruff check src", description = "Run ruff checks" }
black = { cmd = "black src tests", description = "Run the black formatter" }
mypy = { cmd = "mypy", description = "Run mypy type checks (config: [tool.mypy])" }
pre-commit = { cmd = "pre-commit run --all-files && pixi lock", description = "Run pre-commit hooks" }
pre-commit-install = { cmd = "pre-commit install", description = "Install pre-commit hooks" }
[tool.pixi.feature.docs.tasks]
docs = { cmd = "sphinx-build -W --keep-going -b html docs docs/_build/html", description = "Build the docs (warnings are errors)" }
[tool.pixi.feature.py310.dependencies]
python = "3.10.*"
[tool.pixi.feature.py311.dependencies]
python = "3.11.*"
[tool.pixi.feature.py312.dependencies]
python = "3.12.*"
[tool.pixi.feature.py313.dependencies]
python = "3.13.*"
# numpydoc validation (pre-commit hook ``numpydoc-validation``)
# ------------------------------------------------------------
# The second half of the enforcement ruff can't do: ruff's ``D`` rules check that the
# *sections* are well formed, but under ``convention = "numpy"`` D417 is off, so nothing
# there checks that the sections say anything true about the signature. These do —
# every parameter documented, in order, and a ``Returns`` section wherever a value comes
# back.
[tool.numpydoc_validation]
checks = [
"PR01", # parameters not documented
"PR02", # documented parameters that don't exist
"PR03", # parameters documented out of signature order
"PR04", # parameter has no type
"PR05", # parameter type ends with a period
"PR06", # parameter type uses a non-canonical spelling (integer -> int, ...)
"PR07", # parameter has no description
"RT01", # no Returns section where a value is returned
"RT03", # return value has no description
"RT04", # return value type ends with a period
"GL02", # closing quotes on their own line
"GL03", # double line break in the middle of a docstring
"YD01", # a Yields section where the callable yields
]
# Deliberately *not* enabled:
# - GL01 (summary on the line after the opening quotes). numpydoc's own format asks for
# it; this codebase, black and ruff's D rules all put the summary on the opening line,
# and nothing about the sections depends on which one you pick.
# - ES01/SA01/EX01 (an extended summary / See Also / Examples on every object). Most
# private helpers here need none of the three, and requiring them buys padding.