forked from applied-material-modeling/neml2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
182 lines (166 loc) · 5.66 KB
/
Copy pathpyproject.toml
File metadata and controls
182 lines (166 loc) · 5.66 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
[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
minimum-version = "0.10"
# dependencies: cmake.version_min
cmake.version = ">=3.26.1"
cmake.build-type = "Release"
ninja.version = ">=1.11"
ninja.make-fallback = false
sdist.exclude = [
".github",
".clang-format",
".clang-tidy",
".gitattributes",
".gitignore",
".gitmodules",
".jupytext.toml",
".pre-commit-config.yaml",
"scripts",
"notebooks",
"tests",
]
build-dir = "build/{wheel_tag}"
build.targets = ["aoti", "pyneml2"]
wheel.install-dir = "neml2"
wheel.packages = ["neml2"]
[tool.scikit-build.cmake.define]
NEML2_WHEEL = "ON"
[project]
name = "neml2"
# dependencies: neml2.version
version = "3.0.2"
authors = [
{ name = "Mark Messner", email = "messner@anl.gov" },
{ name = "Gary Hu", email = "thu@anl.gov" },
]
description = "GPU-enabled vectorized material modeling library"
readme = "README.md"
# dependencies: python.version_min
requires-python = ">=3.10"
dependencies = [
# Lower bound is a hard pin (older torch has known-incompatible ABI). The
# upper bound is intentionally left open: newer torch may or may not work,
# so we let the user opt in rather than block the install. See
# doc/content/installation/compatibility.md for the regression-tested set.
# dependencies: torch.version_min
"torch>=2.10.0",
# dependencies: pyzag.version
"pyzag==1.1.1",
# dependencies: nmhit.version_min
"nmhit>=0.2.2",
]
[project.optional-dependencies]
dev = [
# testing
"pytest",
"pytest-xdist",
"nbmake",
# lint + format
# dependencies: ruff.version
"ruff==0.15.13",
# typecheck
# dependencies: pyright.version
"pyright==1.1.409",
"PyYAML",
"matplotlib",
"numpy",
"scipy",
"pandas",
"loguru",
"pyro-ppl",
"tqdm",
# docs
"sphinx",
"shibuya",
"myst-parser[linkify]",
"myst-nb",
"sphinx-autobuild",
"sphinx-copybutton",
"sphinxcontrib-programoutput",
# git
"pre-commit",
]
[project.scripts]
neml2-compile = "neml2.cli.aoti_compile:main"
neml2-inspect = "neml2.cli.inspect:main"
neml2-run = "neml2.cli.run:main"
neml2-syntax = "neml2.cli.syntax:main"
[tool.ruff]
line-length = 100
# Tracks `requires-python` above; format is ruff's "pyXY" rather than "X.Y", so
# scripts/dep_manager.py cannot tie this automatically — bump by hand when the
# minimum Python bumps.
target-version = "py310"
extend-exclude = ["contrib", "build", "installed", "notebooks"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "B", "UP"]
# E741 ("ambiguous variable name") is a poor fit for mathematical software,
# where single-character symbols like `I` (identity), `N` (flow direction),
# `K`/`G` (moduli) are domain-standard notation and far clearer than
# `ident_matrix`/`flow_dir`/etc. Disable globally; bring it back per-file
# if a non-math module accumulates genuinely ambiguous one-letter names.
ignore = ["E741"]
[tool.ruff.lint.per-file-ignores]
# Re-export shims: __init__.py files routinely import names for the sole
# purpose of exposing them on the package surface, and `from .x import *`
# is the only practical pattern when the source is a compiled pybind11
# submodule with ~100 public names.
"**/__init__.py" = ["F401", "F403", "F405"]
# Pedagogical scripts; short ambiguous names and the occasional unused loop
# index are part of how the tutorials read.
"doc/content/tutorials/**/*.py" = ["B007"]
[tool.pyright]
# Default scope is everything outside the package itself, so contributors can
# run pyright without first building a neml2 wheel. The CI `typecheck` job
# additionally targets the installed wheel separately
# (see .github/workflows/python.yml). doc/content/tutorials/ and the
# benchmark/ inputs are intentionally excluded -- they target the retired
# legacy C++ surface and will be rewritten as a follow-up.
include = [
"scripts",
"doc",
]
exclude = [
# pyright's built-in defaults (specifying `exclude` replaces them, so they
# must be repeated here to keep .git/, __pycache__/, dotfiles, etc. ignored)
"**/node_modules",
"**/__pycache__",
"**/.*",
# project-specific
"contrib",
"build",
"installed",
"notebooks",
]
# dependencies: python.version_min
pythonVersion = "3.10"
# torch's own stubs don't re-export common symbols (`tensor`, `device`,
# `float64`, ...) via __all__, so `from torch import X` floods this rule
# with false positives. Qualified `torch.X` access still works as expected.
reportPrivateImportUsage = "none"
[tool.pytest.ini_options]
# `importlib` import mode is load-bearing: the package source tree lives at
# `./neml2/` next to `pyproject.toml`, so the default `prepend` mode pushes the
# project root onto sys.path and `import neml2` resolves to the source dir
# instead of the installed wheel. That hides the pybind11 `_aoti.so` (built
# into the wheel under `<site-packages>/neml2/aoti/`) and trips
# `ModuleNotFoundError: No module named 'neml2.aoti._aoti'` once any AOTI
# test actually runs. importlib mode leaves sys.path alone.
addopts = "--import-mode=importlib"
[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-* cp313-* cp314-*"
skip = "*win* *manylinux_i686 *manylinux_aarch64 *manylinux_ppc64le *manylinux_s390x *manylinux_armv7l *musllinux*"
environment = { CMAKE_GENERATOR = "Ninja" }
build-verbosity = 1
build-frontend = { name = "build", args = ["--no-isolation"] }
before-all = ""
before-build = "python -m pip install scikit-build-core ninja torch wheel"
# dependencies: pyzag.version
test-requires = "pytest torch pyzag==1.1.1"
test-command = "pytest -v {project}/tests"
[tool.cibuildwheel.linux]
repair-wheel-command = "python {project}/scripts/repair_wheel.py {wheel} {dest_dir}"
[tool.cibuildwheel.macos]
repair-wheel-command = "python {project}/scripts/repair_wheel.py {wheel} {dest_dir}"