-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathpyproject.toml
More file actions
462 lines (424 loc) · 14.1 KB
/
Copy pathpyproject.toml
File metadata and controls
462 lines (424 loc) · 14.1 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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# -- Build system requirements (PEP 518) --
[build-system]
build-backend = 'setuptools.build_meta'
requires = ['cython>=3.0.0', 'setuptools>=77.0.3', 'versioningit>=3.1.1', 'wheel>=0.33.6']
# -- Dependency groups --
[dependency-groups]
build = ['cython>=3.0.0', 'pip>=22.1.1', 'setuptools>=77.0.3', 'wheel>=0.33.6']
dev = [
{include-group = 'build'},
{include-group = 'docs'},
{include-group = 'frameworks'},
{include-group = 'lint'},
{include-group = 'profiling'},
{include-group = 'scripts'},
{include-group = 'test'},
{include-group = 'typing'}
]
docs = [
'esbonio>=0.16.0',
'jupytext>=1.14',
'matplotlib>=3.9.0',
'myst-parser>=4.0.0',
'pygments>=2.7.3',
'sphinx>=7.3.7',
'sphinx-rtd-theme>=3.0.1',
'sphinx-toolbox>=3.8.1'
]
frameworks = [
# 3rd party frameworks with some interoperability with gt4py
'atlas4py>=0.41'
]
lint = [
'pre-commit>=4.0.1',
'ruff>=0.8.0',
'tach>=0.23.0',
'validate-pyproject-schema-store[all]>=2025.06.13'
]
profiling = [
'nvtx>=0.2.14',
'viztracer>=1.1.1'
]
scripts = ["pyyaml>=6.0.1", "typer>=0.16.0", "packaging"]
test = [
'hypothesis>=6.0.0',
'nbmake>=1.4.6',
'nox>=2025.02.09',
'pytest>=8.0.1',
'pytest-benchmark>=5.0.0',
'pytest-cache>=1.0',
'pytest-factoryboy>=2.6.1',
'pytest-instafail>=0.5.0',
'pytest-xdist[psutil]>=3.5.0'
]
typing = [
'mypy[faster-cache]>=1.13.0',
'types-tabulate>=0.8.10',
'types-PyYAML>=6.0.10',
'types-decorator>=5.1.8',
'types-docutils>=0.21.0',
'types-pytz>=2024.2.0'
]
typing_exports = [
# to test typing with gt4py in downstream code
{include-group = "typing"},
'types-six>=1.17.0.20251009', # can not let mypy auto-install types as that leads to unexpected stderr output (which means test failure)
'pytest-mypy-plugins>=4.0.0', # pytest plugin for running mypy on code snippets
"xarray>=2024.1.0" # one of the regression tests requires xarray
]
# -- Standard project description options (PEP 621) --
[project]
authors = [{name = 'ETH Zurich', email = 'gridtools@cscs.ch'}]
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: GPU :: NVIDIA CUDA',
'Intended Audience :: Science/Research',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering :: Atmospheric Science',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Physics'
]
dependencies = [
'attrs>=21.3',
'array-api-compat>=1.13',
'black>=25.11',
'boltons>=20.1',
'cached-property>=1.5.1',
'click>=8.0.0',
'cmake>=3.22',
'cytoolz>=1.0.1',
'dace==2.0.0a9',
'deepdiff>=8.1.0',
'devtools>=0.6',
'factory-boy>=3.3.3',
"filelock>=3.18.0",
'frozendict>=2.3',
'gridtools-cpp>=2.3.9,==2.*',
'jinja2>=3.0.0',
'lark>=1.1.2',
'mako>=1.3',
'nanobind>=1.9.0',
'ninja>=1.11',
'numpy>=2.0.0 ; python_version < "3.14"',
'numpy>=2.3.2 ; python_version >= "3.14"', # first version with pre-built wheel for Python 3.14
'ordered-set>=4.1.0',
'packaging>=20.0',
'pybind11>=3.0.3',
'setuptools>=77.0.3',
'tabulate>=0.8.10',
'toolz>=0.12.1',
'typing-extensions>=4.12.0',
'versioningit>=3.1.1',
'xxhash>=3.5.0'
]
description = 'Python library for generating high-performance implementations of stencil kernels for weather and climate modeling from a domain-specific language (DSL)'
dynamic = ['version']
keywords = [
'gridtools',
'stencil',
'weather',
'climate',
'performance',
'portable',
'hpc'
]
license = 'BSD-3-Clause'
license-files = ['LICENSE']
name = 'gt4py'
readme = 'README.md'
# TODO(egparedes): remove the exclusions when possible
# 3.13.10, 3.14.1 excluded due to bugs breaking dataclasses for Networkx
# - https://github.com/networkx/networkx/issues/8362
# - https://github.com/python/cpython/issues/142214
requires-python = '>=3.12, <3.15, !=3.13.10, !=3.14.1'
[project.optional-dependencies]
cartesian = ['gt4py[jax,standard,testing]']
cuda12 = ['cupy-cuda12x>=12.0']
cuda13 = ['cupy-cuda13x>=14.0']
jax = [
'jax>=0.4.26 ; python_version < "3.14"',
'jax>=0.9.1 ; python_version >= "3.14"' # first version with pre-built wheel for Python 3.14
]
jax-cuda12 = ['jax[cuda12-local]>=0.6.0', 'gt4py[cuda12]']
jax-cuda13 = ['jax[cuda13-local]>=0.7.0', 'gt4py[cuda13]']
next = ['gt4py[jax,standard,testing]']
rocm6 = ['cupy>=13.4.1,<14.0']
rocm7 = ['cupy-rocm-7-0>=14.0']
standard = ['clang-format>=18.1', 'scipy>=1.16.1']
testing = ['hypothesis>=6.93', 'pytest>=7.0']
[project.urls]
Documentation = 'https://gridtools.github.io/gt4py'
Homepage = 'https://gridtools.github.io/'
Repository = 'https://github.com/GridTools/gt4py'
# ---- Other tools ----
# -- mypy --
[tool.mypy]
disallow_incomplete_defs = true
disallow_untyped_defs = true
exclude = ['build/.*$', 'docs/.*$', 'tests/.*$']
ignore_missing_imports = true
implicit_optional = false
implicit_reexport = false
install_types = true
namespace_packages = false
plugins = ['gt4py.next.type_system.mypy_plugin']
# Pin to the lowest supported version, otherwise the type-check floor silently
# follows whichever interpreter happens to run mypy.
python_version = '3.12'
# pretty = true
show_column_numbers = true
show_error_codes = true
warn_redundant_casts = true
warn_unused_configs = false
warn_unused_ignores = true
# GT4Py configs
[[tool.mypy.overrides]]
disallow_incomplete_defs = true
disallow_untyped_defs = true
ignore_missing_imports = false
module = 'gt4py.*'
[[tool.mypy.overrides]]
# The following ignore_errors are only temporary.
# TODO: Fix errors and enable these settings.
disallow_incomplete_defs = false
disallow_untyped_defs = false
follow_imports = 'silent'
module = 'gt4py.cartesian.*'
[[tool.mypy.overrides]]
disable_error_code = "call-arg"
module = 'gt4py.cartesian.frontend.nodes'
[[tool.mypy.overrides]]
ignore_errors = true
module = 'gt4py.cartesian.frontend.node_util'
[[tool.mypy.overrides]]
ignore_errors = true
module = 'gt4py.cartesian.frontend.gtscript_frontend'
[[tool.mypy.overrides]]
disable_error_code = "call-arg"
module = 'gt4py.cartesian.frontend.defir_to_gtir'
[[tool.mypy.overrides]]
module = 'gt4py.eve.extended_typing'
warn_unused_ignores = false
[[tool.mypy.overrides]]
# TODO: Make this false and fix errors
disallow_untyped_defs = false
follow_imports = 'silent'
module = 'gt4py.storage.*'
warn_unused_ignores = false
[[tool.mypy.overrides]]
disallow_incomplete_defs = false
disallow_untyped_defs = false
module = 'gt4py.next.iterator.*'
[[tool.mypy.overrides]]
ignore_errors = true
module = 'gt4py.next.iterator.runtime'
[[tool.mypy.overrides]]
ignore_missing_imports = true
implicit_reexport = true
# factory-boy is broken, see https://github.com/FactoryBoy/factory_boy/pull/1114
module = "factory.*"
# -- pytest --
[tool.pytest]
[tool.pytest.ini_options]
markers = [
'all: special marker that skips all tests',
'requires_atlas: tests that require `atlas4py` bindings package',
'requires_gpu: tests that require a NVidia GPU (`cupy` and `cudatoolkit` are required)',
'requires_jax: tests that require `jax` package',
'uses_applied_shifts: tests that require backend support for applied-shifts',
'uses_can_deref: tests that require backend support for can_deref builtin function',
'uses_composite_shifts: tests that use composite shifts in unstructured domain',
'uses_constant_fields: tests that require backend support for constant fields',
'uses_dace: tests that exercise the `dace` backend',
'uses_dynamic_offsets: tests that require backend support for dynamic offsets',
'uses_floordiv: tests that require backend support for floor division',
'uses_if_stmts: tests that require backend support for if-statements',
'uses_index_fields: tests that require backend support for index fields',
'uses_ir_if_stmts',
'uses_lift: tests that require backend support for lift builtin function',
'uses_negative_modulo: tests that require backend support for modulo on negative numbers',
'uses_origin: tests that require backend support for domain origin',
'uses_reduce_with_lambda: tests that use lambdas as reduce functions',
'uses_reduction_with_only_sparse_fields: tests that require backend support for with sparse fields',
'uses_scalar_in_domain_and_fo',
'uses_scan: tests that uses scan',
'uses_scan_in_field_operator: tests that require backend support for scan in field operator',
'uses_scan_in_stencil: tests that require backend support for scan in stencil',
'uses_scan_without_field_args: tests that require calls to scan that do not have any fields as arguments',
'uses_scan_nested: tests that use nested scans',
'uses_sparse_fields: tests that require backend support for sparse fields',
'uses_sparse_fields_as_output: tests that require backend support for writing sparse fields',
'uses_strided_neighbor_offset: tests that require backend support for strided neighbor offset',
'uses_tuple_args: tests that require backend support for tuple arguments',
'uses_tuple_args_with_different_but_promotable_dims: test that requires backend support for tuple args with different but promotable dims',
'uses_tuple_iterator: tests that require backend support to deref tuple iterators',
'uses_tuple_returns: tests that require backend support for tuple results',
'uses_zero_dimensional_fields: tests that require backend support for zero-dimensional fields',
'uses_cartesian_shift: tests that use a Cartesian connectivity',
'uses_unstructured_shift: tests that use a unstructured connectivity',
'uses_max_over: tests that use the max_over builtin',
'uses_mesh_with_skip_values: tests that use a mesh with skip values',
'uses_concat_where: tests that use the concat_where builtin',
'embedded_concat_where_infinite_domain: tests with concat_where resulting in an infinite domain',
'embedded_concat_where_non_contiguous_domain: tests with concat_where on non-contiguous domains',
'uses_program_metrics: tests that require backend support for program metrics',
'uses_program_with_sliced_out_arguments: tests that use a sliced argument which is not supported for non-mutable arrays, e.g. JAX',
'checks_specific_error: tests that rely on the backend to produce a specific error message'
]
norecursedirs = ['dist', 'build', '_local/*', '.*']
python_files = ['test_*.py', '*_test.py', 'benchmark_*.py']
python_functions = ['test_*', 'benchmark_*']
testpaths = 'tests'
xfail_strict = true
# -- ruff --
[tool.ruff]
line-length = 100
respect-gitignore = true
show-fixes = true
# show-source = true
target-version = 'py312'
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
# -- Rules set to be considered --
# A: flake8-builtins
# B: flake8-bugbear
# C4: flake8-comprehensions
# CPY: flake8-copyright
# D: pydocstyle
# DOC: pydoclint
# E: pycodestyle
# ERA: eradicate
# F: Pyflakes
# FA100: future-rewritable-type-annotation
# FBT: flake8-boolean-trap
# FLY: flynt
# I: isort
# ICN: flake8-import-conventions
# ISC: flake8-implicit-str-concat
# N: pep8-naming
# NPY: NumPy-specific rules
# PERF: Perflint
# PGH: pygrep-hooks
# PTH: flake8-use-pathlib
# Q: flake8-quotes
# RUF: Ruff-specific rules
# SIM: flake8-simplify
# T10: flake8-debugger
# TD: flake8-todos
# UP: pyupgrade
# YTT: flake8-2020
exclude = ['docs/**', "examples/**", "tests/**"]
explicit-preview-rules = true
extend-select = ["F822"] # TODO(egparedes): remove when not longer in preview
ignore = [
'E501', # [line-too-long]
'B905', # [zip-without-explicit-strict] # TODO(egparedes): remove when possible
'TD003' # [missing-todo-link]
]
preview = true # use only with explicit-preview-rules=true
select = ['A', 'B', 'CPY', 'E', 'ERA', 'F', 'FA100', 'I', 'ISC', 'NPY', 'Q', 'RUF', 'T10', 'YTT']
typing-modules = ['gt4py.eve.extended_typing']
unfixable = []
[tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = ['builtins', 'typing']
[tool.ruff.lint.isort]
combine-as-imports = true
# force-wrap-aliases = true
known-first-party = ['gt4py', '__externals__', '__gtscript__']
known-third-party = [
'attr',
'array-api-compat',
'black',
'boltons',
'cached_property',
'click',
'cupy',
'dace',
'devtools',
'factory',
'hypothesis',
'jinja2',
'mako',
'networkx',
'numpy',
'packaging',
'pybind11',
'pytest',
'pytest_factoryboy',
'setuptools',
'tabulate',
'typing_extensions',
'xxhash'
]
lines-after-imports = 2
order-by-type = true
section-order = [
'future',
'standard-library',
'third-party',
'first-party',
'tests',
'local-folder'
]
split-on-trailing-comma = false
[tool.ruff.lint.isort.sections]
'tests' = ['cartesian_tests', 'eve_tests', 'next_tests', 'storage_tests']
[tool.ruff.lint.mccabe]
max-complexity = 15
# -- setuptools build backend --
[tool.setuptools]
platforms = ['Linux', 'Mac']
[tool.setuptools.cmdclass]
# This is required for the `onbuild` versioningit hook
build_py = "versioningit.cmdclass.build_py"
sdist = "versioningit.cmdclass.sdist"
[tool.setuptools.package-data]
'*' = ['*.in', '*.txt']
'gt4py' = ['py.typed', '*.md', '*.rst']
[tool.setuptools.packages]
find = {namespaces = false, where = ['src']}
# -- uv: packages & workspace --
[tool.uv]
conflicts = [
[
{extra = 'cuda12'},
{extra = 'jax-cuda13'},
{extra = 'rocm6'},
{extra = 'rocm7'}
]
]
default-groups = ["dev"]
required-version = ">=0.6.10"
[[tool.uv.index]]
explicit = true
name = 'test.pypi'
url = 'https://test.pypi.org/simple'
[[tool.uv.index]]
explicit = true
name = 'gridtools'
url = 'https://gridtools.github.io/pypi/'
# Add the uv source below to pull dace from the gridtools index instead of PyPI:
# dace = {index = "gridtools"}
[tool.uv.sources]
atlas4py = {index = "test.pypi"}
# -- versioningit --
[tool.versioningit]
default-version = "1.2.2+unknown.version.details"
[tool.versioningit.format]
dirty = "{base_version}+dirty" # Example: 1.2.3+dirty
distance = "{base_version}.post{distance}+{rev}" # Example: 1.2.3.post42+e174a1f
distance-dirty = "{base_version}.post{distance}+{rev}.dirty" # Example: 1.2.3.post42+e174a1f.dirty
[tool.versioningit.onbuild]
build-file = "gt4py/__about__.py"
regex = "^\\s*on_build_version:\\s*Final\\s*=\\s*(?P<version>.*)"
source-file = "src/gt4py/__about__.py"
[tool.versioningit.vcs]
describe-subst = "$Format:%(describe:tags,match=v*)$"
method = "git-archive"