Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
328 lines (285 loc) · 10.5 KB
/
Copy pathpyproject.toml
File metadata and controls
328 lines (285 loc) · 10.5 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
[project]
name = "recursive_diff"
authors = [{ name = "Guido Imperiale", email = "crusaderky@gmail.com" }]
license = { text = "Apache" }
description = "Recursively compare two Python data structures"
keywords = ["diff", "recursive", "xarray", "pandas"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Free Threading :: 2 - Beta",
]
requires-python = ">=3.9"
dependencies = [
"numpy >= 1.23",
"pandas >= 1.5",
"xarray >= 2023.8.0",
]
dynamic = ["version"]
[project.optional-dependencies]
all = [
"dask >= 2022.7.0",
# netcdf4 supports both NetCDF v3 and v4, unlike h5netcdf which
# supports only v4 and scipy which supports only v3
"netcdf4 >= 1.6",
"msgpack >= 1.0",
"PyYAML >= 5.4",
"zarr >= 2.15",
]
[project.urls]
homepage = "https://github.com/crusaderky/recursive_diff"
issues = "https://github.com/crusaderky/recursive_diff/issues"
documentation = "https://recursive-diff.readthedocs.io/"
changelog = "https://recursive-diff.readthedocs.io/en/latest/whats-new.html"
[project.readme]
text = "Recursively compare two Python data structures"
content-type = "text/plain"
[project.scripts]
recursive-diff = "recursive_diff.cli.recursive_diff:main"
ncdiff = "recursive_diff.cli.ncdiff:main"
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config -v -r sxfE --color=yes --durations=10"
xfail_strict = true
python_files = ["test_*.py"]
testpaths = ["recursive_diff/tests"]
filterwarnings = ["error"]
markers = [
"slow: test takes a long time to run",
# Needed when pytest-run-parallel is not installed
"thread_unsafe: always run on a single thread",
]
[tool.coverage.report]
show_missing = true
[tool.codespell]
skip = "pixi.lock,build,htmlcov"
[tool.ruff]
exclude = [".eggs"]
target-version = "py38"
[tool.ruff.lint]
ignore = [
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"N802", # Function name should be lowercase
"N803", # Argument name should be lowercase
"N806", # Variable should be lowercase
"N816", # Variable in global scope should not be mixedCase
"PT006", # Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
"PLC0415", # `import` should be at the top-level of a file
"PLR0912", # Too many branches
"PLR0913", # Too many arguments in function definition
"PLR0915", # Too many statements
"PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable
"PLW1641", # Object does not implement `__hash__` method
"PLW2901", # for loop variable overwritten by assignment target
"SIM108", # Use ternary operator instead of if-else block
]
select = [
"YTT", # flake8-2020
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"EXE", # flake8-executable
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"RET", # flake8-return
"SIM", # flake8-simplify
"ARG", # flake8-unused-arguments
"I", # isort
"NPY", # NumPy specific rules
"N", # pep8-naming
"E", # Pycodestyle
"W", # Pycodestyle
"PGH", # pygrep-hooks
"F", # Pyflakes
# "PD", # pandas-vet
"PL", # pylint
"UP", # pyupgrade
"RUF", # unused-noqa
"TID", # tidy-ups
"EXE001", # Shebang is present but file is not executable
]
[tool.ruff.lint.isort]
known-first-party = ["recursive_diff"]
[tool.mypy]
files = ["recursive_diff"]
python_version = "3.9"
disallow_incomplete_defs = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_unreachable = true
enable_error_code = ["ignore-without-code", "possibly-undefined", "truthy-bool"]
[[tool.mypy.overrides]]
module = ["*.tests.*"]
disallow_untyped_defs = false
[tool.pixi.workspace]
channels = ["https://prefix.dev/conda-forge"]
platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64", "win-64"]
[tool.pixi.dependencies]
python = "*"
numpy = "*"
pandas = "*"
xarray = "*"
[tool.pixi.feature.dask-core.dependencies]
dask-core = "*"
[tool.pixi.feature.dask.dependencies]
dask-core = "*"
distributed = "*"
[tool.pixi.feature.files.dependencies]
msgpack-python = "*"
PyYAML = "*"
netcdf4 = "*" # netCDF engine
libnetcdf = "!=4.10.0" # Breaks coverage
scipy = "*" # netCDF engine
h5netcdf = "*" # netCDF engine
zarr = "*"
[tool.pixi.feature.lint.dependencies]
lefthook = "*"
ruff = "*"
mypy = "*"
dprint = "*"
actionlint = "*"
shellcheck = "*" # Runs inside actionlint
pyflakes = "*" # Runs inside actionlint
codespell = "*"
blacken-docs = "*"
validate-pyproject = "*"
sphinx-lint = "*"
# mypy check dependencies
dask-core = "*"
types-PyYAML = "*"
[tool.pixi.feature.lint.tasks]
install-git-hooks = { cmd = "lefthook install", description = "Install pre-commit hooks" }
lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run all linters" }
[tool.pixi.feature.smoke.tasks]
smoke-test = { cmd = "python smoke_test.py", description = "Test import the library and print essential information" }
[tool.pixi.feature.tests.dependencies]
pytest = "*"
pytest-cov = "*"
psutil = "*"
[tool.pixi.feature.tests.tasks]
tests = { cmd = "pytest", description = "Run tests" }
tests-cov = { cmd = "pytest --cov --cov-report=xml --cov-report=term", description = "Run tests with coverage" }
coverage = { cmd = "coverage html", depends-on = ["tests-cov"], description = "Generate test coverage html report" }
open-coverage = { cmd = "open htmlcov/index.html", depends-on = ["coverage"], description = "Open test coverage report" }
[tool.pixi.feature.docs.dependencies]
pip = "*"
sphinx = "*"
sphinx_rtd_theme = "*"
myst-nb = "*"
[tool.pixi.feature.docs.tasks]
docs = { cmd = "sphinx-build -n -j auto -b html -d ../build/doctrees . ../build/html", env = { PYTHONPATH = "$PIXI_PROJECT_ROOT" }, cwd = "doc", description = "Build docs" }
open-docs = { cmd = "open build/html/index.html", depends-on = ["docs"], description = "Open the generated docs" }
doc-requirements = { cmd = "echo '# File generated by `pixi run doc-requirements`' > doc/requirements.yml && pixi workspace export conda-environment -e docs >> doc/requirements.yml", description = "Export doc requirements for readthedocs CI" }
[tool.pixi.feature.ipython.dependencies]
ipython = "*"
[tool.pixi.feature.ipython.tasks]
ipython = { cmd = "ipython", description = "Launch IPython" }
[tool.pixi.feature.jupyter.dependencies]
jupyterlab = "*"
python-graphviz = "*"
[tool.pixi.feature.jupyter.tasks]
jupyter = { cmd = "jupyter lab", description = "Launch JupyterLab" }
[tool.pixi.feature.py39.dependencies]
python = "=3.9"
[tool.pixi.feature.py311.dependencies]
python = "=3.11"
[tool.pixi.feature.py314.dependencies]
python = "=3.14"
[tool.pixi.feature.nogil.dependencies]
python-freethreading = "=3.14"
pytest-run-parallel = "*"
# Cut-down `files` feature
# netcdf4 = "*" # cftime not yet available for 3.14t
scipy = "*"
# h5netcdf = "*" # h5py not yet available for 3.14t
msgpack-python = "*"
PyYAML = "*"
# zarr = "*" # numcodecs not yet available for 3.14t
[tool.pixi.feature.mindeps.dependencies]
python = "=3.9"
numpy = "=1.23"
pandas = "=1.5"
xarray = "=2023.8.0"
# Optional dependencies
dask-core = "=2022.7.0"
netcdf4 = "=1.6" # netCDF engine
scipy = "=1.8" # netCDF engine
h5netcdf = "=1.0" # netCDF engine
h5py = "=3.6" # h5netcdf dependency
msgpack-python = "=1.0"
PyYAML = "=5.4"
zarr = "=2.15"
# xarray 2024.5 is the first xarray release to be memory-efficient
# when accessing large NetCDF and Zarr files
[tool.pixi.feature.xarray2024-5.dependencies]
python = "=3.9"
numpy = "=1.23"
pandas = "=2.0"
xarray = "=2024.5.0"
# Optional dependencies
dask-core = "=2024.5.0"
netcdf4 = "=1.6" # netCDF engine
scipy = "=1.10" # netCDF engine
h5netcdf = "=1.1" # netCDF engine
h5py = "=3.8" # h5netcdf dependency
msgpack-python = "=1.0"
PyYAML = "=5.4"
zarr = "=2.15"
[tool.pixi.feature.upstream.dependencies]
python = "=3.14"
[tool.pixi.feature.upstream.pypi-dependencies]
numpy = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
pandas = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
scipy = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
h5py = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
xarray = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
zarr = { index = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" }
dask = { git = "https://github.com/dask/dask.git" }
h5netcdf = { git = "https://github.com/h5netcdf/h5netcdf.git" }
[tool.pixi.feature.dist.dependencies]
python-build = "*"
twine = "*"
[tool.pixi.feature.dist.tasks]
dist-clear = { cmd = "rm -rf build dist" }
build = { cmd = "python -m build", description = "Build pypi artifacts" }
dist = { depends-on = ["dist-clear", "build", "twine-check"] }
twine-check = { cmd = "python -m twine check dist/*" }
twine-upload = { cmd = "python -m twine upload dist/*" }
[tool.pixi.environments]
default = { features = ["py314", "dask", "files", "docs", "smoke", "tests", "ipython", "jupyter"] }
dist = { features = ["dist"], no-default-feature = true }
lint = { features = ["lint"] }
docs = { features = ["py314", "dask", "files", "docs"] }
mindeps = { features = ["mindeps", "smoke", "tests"] }
xarray2024-5 = { features = ["xarray2024-5", "smoke", "tests"] }
py39 = { features = ["py39", "dask", "files", "smoke", "tests"] }
py311 = { features = ["py311", "dask", "files", "smoke", "tests"] }
py314 = { features = ["py314", "dask", "files", "smoke", "tests"] }
no-dask = { features = ["py314", "files", "smoke", "tests"] }
no-optional = { features = ["py314", "smoke", "tests"] }
nogil = { features = ["nogil", "dask-core", "smoke", "tests"] }
upstream = { features = ["upstream", "smoke", "tests"], no-default-feature = true }
smoke = { features = ["smoke"] }