Skip to content

Commit faac638

Browse files
committed
BLD/DEV: use meson-python, add a basic Pixi workspace
1 parent 0d15d23 commit faac638

17 files changed

Lines changed: 196 additions & 25 deletions

File tree

.github/workflows/publish-package.yml

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

4242
- name: Install python-build and twine
4343
run: |
44-
python -m pip install --upgrade pip "setuptools<=67"
44+
python -m pip install --upgrade pip meson-python
4545
python -m pip install build twine
4646
python -m pip list
4747

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ jobs:
6666

6767
- name: Run Tests
6868
run: pytest -v
69+
70+
- name: Run vendoring tests
71+
run: |
72+
rm -rf vendor_tests/array_api_compat
73+
cp -r src/array_api_compat vendor_tests/
74+
pytest -v vendor_tests

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
pixi.lock
2+
vendor_tests/array_api_compat
3+
14
# Byte-compiled / optimized / DLL files
25
__pycache__/
36
*.py[cod]

docs/dev/releasing.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@
4444

4545
- [ ] **Update the version.**
4646

47-
You must edit
47+
You must edit the version in:
4848

4949
```
5050
array_api_compat/__init__.py
51+
pyproject.toml
52+
meson.build
5153
```
5254

53-
and update the version (the version is not computed from the tag because
54-
that would break vendorability).
55-
5655
- [ ] **Update the [changelog](../changelog.md).**
5756

5857
Edit

meson.build

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
project(
2+
'array_api_compat',
3+
version: '1.15.0.dev0',
4+
license: 'MIT',
5+
license_files: ['LICENSE']
6+
)
7+
8+
py = import('python').find_installation()
9+
10+
sources_raw = {
11+
'array_api_compat': [
12+
'src/array_api_compat/__init__.py',
13+
'src/array_api_compat/_internal.py',
14+
],
15+
16+
'array_api_compat/common': [
17+
'src/array_api_compat/common/__init__.py',
18+
'src/array_api_compat/common/_aliases.py',
19+
'src/array_api_compat/common/_fft.py',
20+
'src/array_api_compat/common/_helpers.py',
21+
'src/array_api_compat/common/_linalg.py',
22+
'src/array_api_compat/common/_typing.py',
23+
],
24+
25+
'array_api_compat/cupy': [
26+
'src/array_api_compat/cupy/__init__.py',
27+
'src/array_api_compat/cupy/_aliases.py',
28+
'src/array_api_compat/cupy/_info.py',
29+
'src/array_api_compat/cupy/_typing.py',
30+
'src/array_api_compat/cupy/fft.py',
31+
'src/array_api_compat/cupy/linalg.py',
32+
],
33+
34+
'array_api_compat/dask': [
35+
'src/array_api_compat/dask/__init__.py',
36+
],
37+
38+
'array_api_compat/dask/array': [
39+
'src/array_api_compat/dask/array/__init__.py',
40+
'src/array_api_compat/dask/array/_aliases.py',
41+
'src/array_api_compat/dask/array/_info.py',
42+
'src/array_api_compat/dask/array/fft.py',
43+
'src/array_api_compat/dask/array/linalg.py',
44+
],
45+
46+
'array_api_compat/numpy': [
47+
'src/array_api_compat/numpy/__init__.py',
48+
'src/array_api_compat/numpy/_aliases.py',
49+
'src/array_api_compat/numpy/_info.py',
50+
'src/array_api_compat/numpy/_typing.py',
51+
'src/array_api_compat/numpy/fft.py',
52+
'src/array_api_compat/numpy/linalg.py',
53+
],
54+
55+
'array_api_compat/torch': [
56+
'src/array_api_compat/torch/__init__.py',
57+
'src/array_api_compat/torch/_aliases.py',
58+
'src/array_api_compat/torch/_info.py',
59+
'src/array_api_compat/torch/_typing.py',
60+
'src/array_api_compat/torch/fft.py',
61+
'src/array_api_compat/torch/linalg.py',
62+
],
63+
}
64+
65+
sources = {}
66+
foreach subdir, paths : sources_raw
67+
sources += { subdir : files(paths) }
68+
endforeach
69+
70+
foreach subdir, files : sources
71+
py.install_sources(files, subdir: subdir)
72+
endforeach
73+
74+
subdir('tests')
75+
subdir('vendor_tests')

pixi.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["linux-64", "osx-arm64", "win-64"]
4+
preview = ["pixi-build"]
5+
requires-pixi = ">=0.68.1"
6+
7+
### array-api-compat package definition ###
8+
9+
[package.build.backend]
10+
name = "pixi-build-python"
11+
version = ">=0.5.1"
12+
13+
[package.host-dependencies]
14+
meson-python = "*"
15+
16+
### workspace environments ###
17+
18+
[environments]
19+
docs = ["docs"]
20+
tests = ["tests"]
21+
22+
### default feature definition ###
23+
24+
[dev]
25+
# this pulls in array-api-compat's host dependencies
26+
array-api-compat.path = "."
27+
28+
[dependencies]
29+
array-api-compat.path = "."
30+
31+
### non-default feature definitions ###
32+
33+
[feature.tests.dependencies]
34+
pytest = "*"
35+
array-api-strict = "*"
36+
numpy = "*"
37+
38+
[feature.tests.tasks.tests]
39+
cmd = "pytest -v"
40+
description = "Run tests"
41+
42+
[feature.tests.tasks.clean-vendor-compat]
43+
cmd = "rm -rf vendor_tests/array_api_compat"
44+
description = "Delete the existing vendored version of array-api-compat"
45+
46+
[feature.tests.tasks.copy-vendor-compat]
47+
cmd = "cp -r src/array_api_compat vendor_tests/"
48+
depends-on = ["clean-vendor-compat"]
49+
description = "Vendor a clean copy of array-api-extra"
50+
51+
[feature.tests.tasks.tests-vendor]
52+
cmd = "pytest -v vendor_tests"
53+
depends-on = ["copy-vendor-compat"]
54+
description = "Run vendoring tests"
55+
56+
[feature.docs.dependencies]
57+
furo = "*"
58+
linkify-it-py = "*"
59+
myst-parser = "*"
60+
sphinx = "*"
61+
sphinx-copybutton = "*"
62+
sphinx-autobuild = "*"
63+
64+
[feature.docs.tasks]
65+
docs = { cmd = "make html", cwd = "docs", description = "Build docs" }

pyproject.toml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools", "setuptools-scm"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["meson-python"]
3+
build-backend = "mesonpy"
44

55
[project]
66
name = "array-api-compat"
7-
dynamic = ["version"]
7+
version = "1.15.0.dev0"
88
description = "A wrapper around NumPy and other array libraries to make them compatible with the Array API standard"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -55,15 +55,10 @@ dev = [
5555
homepage = "https://data-apis.org/array-api-compat/"
5656
repository = "https://github.com/data-apis/array-api-compat/"
5757

58-
[tool.setuptools.dynamic]
59-
version = { attr = "array_api_compat.__version__" }
6058

61-
[tool.setuptools]
62-
package-dir = {"" = "src"}
59+
[tool.pytest.ini_options]
60+
testpaths = ["tests"]
6361

64-
[tool.setuptools.packages.find]
65-
where = ["src"]
66-
namespaces = false
6762

6863
[tool.ruff.lint]
6964
preview = true

tests/meson.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
py.install_sources([
2+
'__init__.py',
3+
'_helpers.py',
4+
'test_all.py',
5+
'test_array_namespace.py',
6+
'test_common.py',
7+
'test_copies_or_views.py',
8+
'test_cupy.py',
9+
'test_dask.py',
10+
'test_isdtype.py',
11+
'test_jax.py',
12+
'test_no_dependencies.py',
13+
'test_torch.py',
14+
],
15+
subdir: 'array_api_compat/tests',
16+
install_tag: 'tests'
17+
)

vendor_test/vendored/__init__.py

Whitespace-only changes.

vendor_test/vendored/_compat

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)