Skip to content

Commit 3946625

Browse files
authored
Merge pull request #703 from lucascolley/default-env
2 parents 2690f22 + 9c6f5af commit 3946625

4 files changed

Lines changed: 206 additions & 208 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
3333
with:
34-
pixi-version: v0.62.2
34+
pixi-version: v0.67.2
3535
cache: true
3636
environments: lint
3737

@@ -65,7 +65,7 @@ jobs:
6565

6666
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
6767
with:
68-
pixi-version: v0.62.2
68+
pixi-version: v0.67.2
6969
cache: true
7070
environments: ${{ matrix.environment }}
7171

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
2525
with:
26-
pixi-version: v0.62.0
26+
pixi-version: v0.67.2
2727
cache: true
2828
environments: docs
2929

pixi.toml

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
4+
preview = ["pixi-build"]
5+
requires-pixi = ">=0.63.0"
6+
7+
### array-api-extra package definition ###
8+
9+
[package.build.backend]
10+
name = "pixi-build-python"
11+
version = "*"
12+
13+
[package.host-dependencies]
14+
meson-python = "*"
15+
uv = "*" # interfaces with meson-python instead of pip
16+
17+
[package.run-dependencies]
18+
array-api-compat = "*"
19+
20+
### workspace environments ###
21+
22+
[environments]
23+
default = { features = ["py314"], solve-group = "py314" }
24+
lint = { features = ["py314", "lint"], solve-group = "py314" }
25+
docs = { features = ["py314", "docs"], solve-group = "py314" }
26+
tests = { features = ["py314", "tests"], solve-group = "py314" }
27+
tests-py314 = { features = ["py314", "tests"], solve-group = "py314" } # alias of tests
28+
29+
# Some backends may pin numpy; use separate solve-group
30+
dev = { features = ["py314", "lint", "tests", "docs", "dev", "backends"], solve-group = "backends" }
31+
tests-backends = { features = ["py314", "tests", "backends"], solve-group = "backends" }
32+
tests-backends-py311 = { features = ["py311", "tests", "backends"] }
33+
34+
# CUDA not available on free github actions and on some developers' PCs
35+
dev-cuda = { features = ["py314", "lint", "tests", "docs", "dev", "backends", "cuda-backends"], solve-group = "cuda" }
36+
tests-cuda = { features = ["py314", "tests", "backends", "cuda-backends"], solve-group = "cuda" }
37+
tests-cuda-py311 = { features = ["py311", "tests", "backends", "cuda-backends"] }
38+
39+
# Ungrouped environments
40+
tests-numpy1 = ["py311", "tests", "numpy1"]
41+
tests-py311 = ["py311", "tests"]
42+
tests-nogil = ["nogil", "tests"]
43+
44+
### default feature definition ###
45+
46+
[dev]
47+
# this pulls in array-api-extra's host and run dependencies
48+
array-api-extra.path = "."
49+
50+
[dependencies]
51+
array-api-extra.path = "."
52+
53+
### non-default feature definitions ###
54+
55+
[feature.lint.dependencies]
56+
typing-extensions = ">=4.15.0"
57+
pylint = ">=4.0.5"
58+
mypy = ">=1.20.0"
59+
basedpyright = ">=1.39.0"
60+
numpydoc = ">=1.10.0,<2"
61+
# import dependencies for mypy:
62+
array-api-strict = ">=2.5,<2.6"
63+
numpy = ">=2.1.3"
64+
hypothesis = ">=6.151.9"
65+
dask-core = ">=2026.3.0" # No distributed, tornado, etc.
66+
dprint = ">=0.50.0,<0.51"
67+
lefthook = ">=2.1.5,<3"
68+
ruff = ">=0.15.9,<0.16"
69+
typos = ">=1.44.0,<2"
70+
actionlint = ">=1.7.12,<2"
71+
blacken-docs = ">=1.20.0,<2"
72+
pytest = ">=9.0.3,<10"
73+
validate-pyproject = ">=0.25,<0.26"
74+
pyrefly = ">=0.61.1,<0.62"
75+
zizmor = ">=1.24.1,<1.25"
76+
# NOTE: don't add cupy, jax, pytorch, or sparse here,
77+
# as they slow down mypy and are not portable across target OSs
78+
79+
[feature.lint.tasks]
80+
lefthook = { cmd = "lefthook", description = "Run lefthook", default-environment = "lint" }
81+
hooks = { cmd = "lefthook install", description = "Install pre-commit hooks", default-environment = "lint" }
82+
pre-commit = { cmd = "lefthook run pre-commit", description = "Run pre-commit checks", default-environment = "lint" }
83+
pylint = { cmd = "pylint array_api_extra", cwd = "src", description = "Lint with pylint", default-environment = "lint" }
84+
mypy = { cmd = "mypy", description = "Type check with mypy", default-environment = "lint" }
85+
pyrefly = { cmd = "pyrefly check", description = "Type check with pyrefly", default-environment = "lint" }
86+
pyright = { cmd = "basedpyright", description = "Type check with basedpyright", default-environment = "lint" }
87+
ruff-check = { cmd = "ruff check --fix", description = "Lint with ruff", default-environment = "lint" }
88+
ruff-format = { cmd = "ruff format", description = "Format with ruff", default-environment = "lint" }
89+
dprint = { cmd = "dprint fmt", description = "Format with dprint", default-environment = "lint" }
90+
typos = { cmd = "typos --write-changes --force-exclude", description = "Fix typos", default-environment = "lint" }
91+
actionlint = { cmd = "actionlint", description = "Lint actions with actionlint", default-environment = "lint" }
92+
zizmor = { cmd = "zizmor .github -p", description = "GHA static analysis with zizmor", default-environment = "lint" }
93+
blacken-docs = { cmd = "blacken-docs", description = "Format Python markdown blocks with Black", default-environment = "lint" }
94+
validate-pyproject = { cmd = "validate-pyproject pyproject.toml", description = "Validate pyproject.toml", default-environment = "lint" }
95+
numpydoc = { cmd = "numpydoc lint", description = "Validate docstrings with numpydoc", default-environment = "lint" }
96+
lint = { cmd = "lefthook run pre-commit --all-files --force", description = "Run all linters", default-environment = "lint" }
97+
98+
[feature.tests.dependencies]
99+
pytest = ">=9.0.3"
100+
pytest-cov = ">=7.1.0"
101+
hypothesis = ">=6.151.9"
102+
array-api-strict = ">=2.5,<2.6"
103+
numpy = ">=1.22.0"
104+
scipy = ">=1.15.2,<2"
105+
106+
[feature.tests.tasks]
107+
tests = { cmd = "pytest -v", description = "Run tests", default-environment = "tests" }
108+
tests-cov = { cmd = "pytest -v -ra --cov --cov-report=xml --cov-report=term --durations=20", description = "Run tests with coverage", default-environment = "tests" }
109+
110+
clean-vendor-compat = { cmd = "rm -rf vendor_tests/array_api_compat", description = "Delete the existing vendored version of array-api-compat", default-environment = "tests" }
111+
clean-vendor-extra = { cmd = "rm -rf vendor_tests/array_api_extra", description = "Delete the existing vendored version of array-api-extra", default-environment = "tests" }
112+
copy-vendor-compat = { cmd = "cp -r $(python -c 'import site; print(site.getsitepackages()[0])')/array_api_compat vendor_tests/", depends-on = ["clean-vendor-compat"], description = "Vendor a clean copy of array-api-compat", default-environment = "tests" }
113+
copy-vendor-extra = { cmd = "cp -r src/array_api_extra vendor_tests/", depends-on = ["clean-vendor-extra"], description = "Vendor a clean copy of array-api-extra", default-environment = "tests" }
114+
tests-vendor = { cmd = "pytest -v vendor_tests", depends-on = ["copy-vendor-compat", "copy-vendor-extra"], description = "Check that array-api-extra and array-api-compat can be vendored together", default-environment = "tests" }
115+
116+
tests-ci = { depends-on = ["tests-cov", "tests-vendor"], description = "Run tests with coverage and vendor tests" }
117+
coverage = { cmd = "coverage html", depends-on = ["tests-cov"], description = "Generate test coverage html report", default-environment = "tests" }
118+
open-coverage = { cmd = "open htmlcov/index.html", depends-on = ["coverage"], description = "Open test coverage report", default-environment = "tests" }
119+
120+
[feature.docs.dependencies]
121+
sphinx = ">=7.4.7"
122+
furo = ">=2025.12.19"
123+
myst-parser = ">=5.0.0"
124+
sphinx-copybutton = ">=0.5.2"
125+
sphinx-autodoc-typehints = ">=1.25.3"
126+
# Needed to import parsed modules with autodoc
127+
dask-core = ">=2026.3.0" # No distributed, tornado, etc.
128+
pytest = ">=9.0.3"
129+
typing-extensions = ">=4.15.0"
130+
numpy = ">=2.1.3"
131+
132+
[feature.docs.tasks]
133+
docs = { cmd = "sphinx-build -E -W . build/", cwd = "docs", description = "Build docs", default-environment = "docs" }
134+
open-docs = { cmd = "open build/index.html", cwd = "docs", depends-on = ["docs"], description = "Open the generated docs", default-environment = "docs" }
135+
136+
[feature.dev.dependencies]
137+
ipython = ">=7.33.0"
138+
139+
[feature.dev.tasks]
140+
ipython = { cmd = "ipython", description = "Launch ipython", default-environment = "dev" }
141+
142+
[feature.py311.dependencies]
143+
python = "~=3.11.0"
144+
145+
[feature.py314.dependencies]
146+
python = "~=3.14.0"
147+
148+
[feature.numpy1.dependencies]
149+
# Oldest NumPy version supported by scikit-learn.
150+
# Note that this is older than what SPEC0 recommends.
151+
numpy = "=1.24.1"
152+
153+
# Backends that can run on CPU-only hosts
154+
# Note: JAX and PyTorch will install CPU variants.
155+
[feature.backends.dependencies]
156+
pytorch = ">=2.10.0"
157+
dask-core = ">=2026.3.0" # No distributed, tornado, etc.
158+
sparse = ">=0.18.0"
159+
160+
[feature.backends.target.linux-64.dependencies]
161+
jax = ">=0.9.2"
162+
163+
[feature.backends.target.osx-64.dependencies]
164+
jax = ">=0.9.2"
165+
166+
[feature.backends.target.osx-arm64.dependencies]
167+
jax = ">=0.9.2"
168+
169+
[feature.backends.target.win-64.dependencies]
170+
# jax = "*" # unavailable
171+
172+
# Backends that require a GPU host and a CUDA driver.
173+
# Note that JAX and PyTorch automatically prefer CUDA variants
174+
# thanks to the `system-requirements` below, *if available*.
175+
# We request them explicitly below to ensure that we don't
176+
# quietly revert to CPU-only in the future, e.g. when CUDA 13
177+
# is released and CUDA 12 builds are dropped upstream.
178+
[feature.cuda-backends]
179+
system-requirements = { cuda = "12" }
180+
181+
[feature.cuda-backends.target.linux.dependencies]
182+
cupy = ">=14.0.1"
183+
jaxlib = { version = ">=0.9.2", build = "cuda12*" }
184+
pytorch = { version = ">=2.10.0", build = "cuda12*" }
185+
186+
[feature.cuda-backends.target.osx.dependencies]
187+
# cupy = "*" # unavailable
188+
# jaxlib = { version = "*", build = "cuda12*" } # unavailable
189+
# pytorch = { version = "*", build = "cuda12*" } # unavailable
190+
191+
[feature.cuda-backends.target.win.dependencies]
192+
cupy = ">=14.0.1"
193+
# jaxlib = { version = "*", build = "cuda12*" } # unavailable
194+
pytorch = { version = ">=2.10.0", build = "cuda12*" }
195+
196+
[feature.nogil.dependencies]
197+
python-freethreading = "~=3.13.0"
198+
pytest-run-parallel = ">=0.8.2"
199+
numpy = ">=2.3.5"
200+
# pytorch = "*" # Not available on Python 3.13t yet
201+
dask-core = ">=2026.3.0" # No distributed, tornado, etc.
202+
# sparse = "*" # numba not available on Python 3.13t yet
203+
# jax = "*" # ml_dtypes not available on Python 3.13t yet

0 commit comments

Comments
 (0)