forked from pydata/xarray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
337 lines (303 loc) · 10.7 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
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
329
330
331
332
333
334
335
336
337
[project]
authors = [
{name = "xarray Developers", email = "[email protected]"},
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]
description = "N-D labeled arrays and datasets in Python"
dynamic = ["version"]
license = {text = "Apache-2.0"}
name = "xarray"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"numpy>=1.24",
"packaging>=23.1",
"pandas>=2.1",
]
# We don't encode minimum requirements here (though if we can write a script to
# generate the text from `min_deps_check.py`, that's welcome...). We do add
# `numba>=0.54` here because of https://github.com/astral-sh/uv/issues/7881;
# note that it's not a direct dependency of xarray.
[project.optional-dependencies]
accel = ["scipy", "bottleneck", "numbagg", "numba>=0.54", "flox", "opt_einsum"]
complete = ["xarray[accel,etc,io,parallel,viz]"]
dev = [
"hypothesis",
"mypy",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-env",
"pytest-xdist",
"pytest-timeout",
"ruff",
"sphinx",
"sphinx_autosummary_accessors",
"xarray[complete]",
]
io = ["netCDF4", "h5netcdf", "scipy", 'pydap; python_version<"3.10"', "zarr<3", "fsspec", "cftime", "pooch"]
etc = ["sparse"]
parallel = ["dask[complete]"]
viz = ["cartopy", "matplotlib", "nc-time-axis", "seaborn"]
[project.urls]
Documentation = "https://docs.xarray.dev"
SciPy2015-talk = "https://www.youtube.com/watch?v=X0pAhJgySxk"
homepage = "https://xarray.dev/"
issue-tracker = "https://github.com/pydata/xarray/issues"
source-code = "https://github.com/pydata/xarray"
[project.entry-points."xarray.chunkmanagers"]
dask = "xarray.namedarray.daskmanager:DaskManager"
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42",
"setuptools-scm>=7",
]
[tool.setuptools]
packages = ["xarray"]
[tool.setuptools_scm]
fallback_version = "9999"
[tool.coverage.run]
omit = [
"*/xarray/tests/*",
"*/xarray/core/dask_array_compat.py",
"*/xarray/core/npcompat.py",
"*/xarray/core/pdcompat.py",
"*/xarray/core/pycompat.py",
"*/xarray/core/types.py",
]
source = ["xarray"]
[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]
[tool.mypy]
enable_error_code = ["ignore-without-code", "redundant-self", "redundant-expr"]
exclude = [
'build',
'xarray/util/generate_.*\.py',
]
files = "xarray"
show_error_context = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
# Much of the numerical computing stack doesn't have type annotations yet.
[[tool.mypy.overrides]]
ignore_missing_imports = true
module = [
"affine.*",
"bottleneck.*",
"cartopy.*",
"cf_units.*",
"cfgrib.*",
"cftime.*",
"cloudpickle.*",
"cubed.*",
"cupy.*",
"fsspec.*",
"h5netcdf.*",
"h5py.*",
"iris.*",
"mpl_toolkits.*",
"nc_time_axis.*",
"netCDF4.*",
"netcdftime.*",
"opt_einsum.*",
"pint.*",
"pooch.*",
"pyarrow.*",
"pydap.*",
"scipy.*",
"seaborn.*",
"setuptools",
"sparse.*",
"toolz.*",
"zarr.*",
"numpy.exceptions.*", # remove once support for `numpy<2.0` has been dropped
"array_api_strict.*",
]
# Gradually we want to add more modules to this list, ratcheting up our total
# coverage. Once a module is here, functions are checked by mypy regardless of
# whether they have type annotations. It would be especially useful to have test
# files listed here, because without them being checked, we don't have a great
# way of testing our annotations.
[[tool.mypy.overrides]]
check_untyped_defs = true
module = [
"xarray.core.accessor_dt",
"xarray.core.accessor_str",
"xarray.core.alignment",
"xarray.core.computation",
"xarray.core.rolling_exp",
"xarray.indexes.*",
"xarray.tests.*",
]
# This then excludes some modules from the above list. (So ideally we remove
# from here in time...)
[[tool.mypy.overrides]]
check_untyped_defs = false
module = [
"xarray.tests.test_coarsen",
"xarray.tests.test_coding_times",
"xarray.tests.test_combine",
"xarray.tests.test_computation",
"xarray.tests.test_concat",
"xarray.tests.test_coordinates",
"xarray.tests.test_dask",
"xarray.tests.test_dataarray",
"xarray.tests.test_duck_array_ops",
"xarray.tests.test_indexing",
"xarray.tests.test_merge",
"xarray.tests.test_missing",
"xarray.tests.test_parallelcompat",
"xarray.tests.test_sparse",
"xarray.tests.test_ufuncs",
"xarray.tests.test_units",
"xarray.tests.test_utils",
"xarray.tests.test_variable",
"xarray.tests.test_weighted",
]
# Use strict = true whenever namedarray has become standalone. In the meantime
# don't forget to add all new files related to namedarray here:
# ref: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options
[[tool.mypy.overrides]]
# Start off with these
warn_unused_ignores = true
# Getting these passing should be easy
strict_concatenate = true
strict_equality = true
# Strongly recommend enabling this one as soon as you can
check_untyped_defs = true
# These shouldn't be too much additional work, but may be tricky to
# get passing if you use a lot of untyped libraries
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
# These next few are various gradations of forcing use of type annotations
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
# This one isn't too hard to get passing, but return on investment is lower
no_implicit_reexport = true
# This one can be tricky to get passing if you use a lot of untyped libraries
warn_return_any = true
module = ["xarray.namedarray.*", "xarray.tests.test_namedarray"]
# We disable pyright here for now, since including it means that all errors show
# up in devs' VS Code, which then makes it more difficult to work with actual
# errors. It overrides local VS Code settings so isn't escapable.
# [tool.pyright]
# defineConstant = {DEBUG = true}
# # Enabling this means that developers who have disabled the warning locally —
# # because not all dependencies are installable — are overridden
# # reportMissingImports = true
# reportMissingTypeStubs = false
[tool.ruff]
extend-exclude = [
"doc",
"_typed_ops.pyi",
]
[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
extend-safe-fixes = [
"TID252", # absolute imports
]
ignore = [
"E402",
"E501",
"E731",
"UP007",
]
extend-select = [
"B", # flake8-bugbear
"F", # Pyflakes
"E", # Pycodestyle
"W",
"TID", # flake8-tidy-imports (absolute imports)
"I", # isort
"UP", # Pyupgrade
]
[tool.ruff.lint.per-file-ignores]
# don't enforce absolute imports
"asv_bench/**" = ["TID252"]
[tool.ruff.lint.isort]
known-first-party = ["xarray"]
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.pytest.ini_options]
addopts = ["--strict-config", "--strict-markers"]
# We want to forbid warnings from within xarray in our tests — instead we should
# fix our own code, or mark the test itself as expecting a warning. So this:
# - Converts any warning from xarray into an error
# - Allows some warnings ("default") which the test suite currently raises,
# since it wasn't practical to fix them all before merging this config. The
# warnings are reported in CI (since it uses `default`, not `ignore`).
#
# Over time, we can remove these rules allowing warnings. A valued contribution
# is removing a line, seeing what breaks, and then fixing the library code or
# tests so that it doesn't raise warnings.
#
# There are some instance where we'll want to add to these rules:
# - While we only raise errors on warnings from within xarray, a dependency can
# raise a warning with a stacklevel such that it's interpreted to be raised
# from xarray and this will mistakenly convert it to an error. If that
# happens, please feel free to add a rule switching it to `default` here, and
# disabling the error.
# - If these settings get in the way of making progress, it's also acceptable to
# temporarily add additional `default` rules.
# - But we should only add `ignore` rules if we're confident that we'll never
# need to address a warning.
filterwarnings = [
"error:::xarray.*",
"default:No index created:UserWarning:xarray.core.dataset",
"default::UserWarning:xarray.tests.test_coding_times",
"default::UserWarning:xarray.tests.test_computation",
"default::UserWarning:xarray.tests.test_dataset",
"default:`ancestors` has been deprecated:DeprecationWarning:xarray.core.treenode",
"default:`iter_lineage` has been deprecated:DeprecationWarning:xarray.core.treenode",
"default:`lineage` has been deprecated:DeprecationWarning:xarray.core.treenode",
"default:coords should be an ndarray:DeprecationWarning:xarray.tests.test_variable",
"default:deallocating CachingFileManager:RuntimeWarning:xarray.backends.*",
"default:deallocating CachingFileManager:RuntimeWarning:xarray.backends.netCDF4_",
"default:deallocating CachingFileManager:RuntimeWarning:xarray.core.indexing",
"default:Failed to decode variable.*NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays:DeprecationWarning",
"default:The `interpolation` argument to quantile was renamed to `method`:FutureWarning:xarray.*",
"default:invalid value encountered in cast:RuntimeWarning:xarray.core.duck_array_ops",
"default:invalid value encountered in cast:RuntimeWarning:xarray.conventions",
"default:invalid value encountered in cast:RuntimeWarning:xarray.tests.test_units",
"default:invalid value encountered in cast:RuntimeWarning:xarray.tests.test_array_api",
"default:NumPy will stop allowing conversion of:DeprecationWarning",
"default:shape should be provided:DeprecationWarning:xarray.tests.test_variable",
"default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable",
"default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
"default:Duplicate dimension names present:UserWarning:xarray.namedarray.core",
"default:::xarray.tests.test_strategies", # TODO: remove once we know how to deal with a changed signature in protocols
]
log_cli_level = "INFO"
markers = [
"flaky: flaky tests",
"network: tests requiring a network connection",
"slow: slow tests",
"slow_hypothesis: slow hypothesis tests",
]
minversion = "7"
python_files = "test_*.py"
testpaths = ["xarray/tests", "properties"]
[tool.aliases]
test = "pytest"
[tool.repo-review]
ignore = [
"PP308", # This option creates a large amount of log lines.
]