Skip to content

Commit 4ab875d

Browse files
authored
BLD: switch to meson-python (#583)
1 parent 334cf4e commit 4ab875d

File tree

7 files changed

+622
-129
lines changed

7 files changed

+622
-129
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1+
# Excluding files from an sdist generated by meson-python
2+
#########################################################
3+
4+
# Note: when adding to this list, be aware that you need to commit your changes
5+
# before they take effect (can be confusing during testing)
6+
7+
.github/* export-ignore
8+
.git* export-ignore
9+
codecov.yml export-ignore
10+
pixi.lock export-ignore
11+
RELEASING.md export-ignore
12+
renovate.json export-ignore
13+
114
# GitHub syntax highlighting
215
pixi.lock linguist-language=YAML linguist-generated=true

RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
1. Update the version in `src/array_api_extra/__init__.py`
1+
1. Update the version in `pyproject.toml`, `meson.build`, and `src/array_api_extra/__init__.py`
22
2. Update the lockfile with `pixi update; pixi install`
33
3. Push your changes
44
4. Cut a release via the GitHub GUI
5-
5. Update the version to `{next micro version}.dev0`
5+
5. Update the version to `{next micro version}.dev0` in `pyproject.toml`, `meson.build`, and `src/array_api_extra/__init__.py`
66
6. `pixi clean cache --pypi; pixi update; pixi install`
77
7. Push your changes
88
8. Merge the automated PR to conda-forge/array-api-extra-feedstock

meson.build

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
project(
2+
'array-api-extra',
3+
version: '0.10.0.dev0'
4+
)
5+
6+
py = import('python').find_installation()
7+
8+
# NOTE: downstream projects may rely on this variable name when vendoring,
9+
# do not change it without consulting with downstream projects
10+
sources = {
11+
'array_api_extra': files(
12+
'src/array_api_extra/__init__.py',
13+
'src/array_api_extra/_delegation.py',
14+
'src/array_api_extra/testing.py',
15+
),
16+
'array_api_extra/_lib': files(
17+
'src/array_api_extra/_lib/__init__.py',
18+
'src/array_api_extra/_lib/_at.py',
19+
'src/array_api_extra/_lib/_backends.py',
20+
'src/array_api_extra/_lib/_funcs.py',
21+
'src/array_api_extra/_lib/_lazy.py',
22+
'src/array_api_extra/_lib/_testing.py',
23+
),
24+
'array_api_extra/_lib/_utils': files(
25+
'src/array_api_extra/_lib/_utils/__init__.py',
26+
'src/array_api_extra/_lib/_utils/_compat.py',
27+
'src/array_api_extra/_lib/_utils/_compat.pyi',
28+
'src/array_api_extra/_lib/_utils/_helpers.py',
29+
'src/array_api_extra/_lib/_utils/_typing.py',
30+
'src/array_api_extra/_lib/_utils/_typing.pyi',
31+
),
32+
}
33+
34+
foreach subdir, files : sources
35+
py.install_sources(files, subdir: subdir)
36+
endforeach
37+
38+
subdir('tests')
39+
subdir('vendor_tests')

pixi.lock

Lines changed: 495 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
[build-system]
2-
requires = ["hatchling"]
3-
build-backend = "hatchling.build"
2+
requires = ["meson-python"]
3+
build-backend = "mesonpy"
44

55
[project]
66
name = "array-api-extra"
7+
version = "0.10.0.dev0"
78
authors = [
89
{ name = "Lucas Colley", email = "[email protected]" },
910
# { name = "Open Source Contributors" }, # https://github.com/pypi/warehouse/issues/14813
1011
]
1112
description = "Extra array functions built on top of the array API standard."
1213
readme = "README.md"
13-
license.file = "LICENSE"
14+
license = "MIT"
15+
license-files = ["LICENSE"]
1416
requires-python = ">=3.11"
1517
classifiers = [
1618
"Intended Audience :: Developers",
@@ -24,33 +26,67 @@ classifiers = [
2426
"Programming Language :: Python :: Free Threading :: 3 - Stable",
2527
"Typing :: Typed",
2628
]
27-
dynamic = ["version"]
2829
dependencies = ["array-api-compat>=1.13.0,<2"]
2930

3031
[project.urls]
3132
Homepage = "https://github.com/data-apis/array-api-extra"
3233
"Bug Tracker" = "https://github.com/data-apis/array-api-extra/issues"
3334
Changelog = "https://github.com/data-apis/array-api-extra/releases"
3435

35-
# Hatch
36-
37-
[tool.hatch]
38-
version.path = "src/array_api_extra/__init__.py"
39-
40-
[tool.hatch.build.targets.sdist]
41-
exclude = ["codecov.yml", "pixi.lock", "RELEASING.md", "renovate.json"]
42-
43-
#  Pixi
36+
# Pixi
4437

4538
[tool.pixi.workspace]
4639
channels = ["https://prefix.dev/conda-forge"]
4740
platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"]
41+
preview = ["pixi-build"]
42+
43+
### array-api-extra package definition ###
44+
45+
[tool.pixi.package.build.backend]
46+
name = "pixi-build-python"
47+
version = "*"
48+
49+
[tool.pixi.package.host-dependencies]
50+
meson-python = "*"
51+
uv = "*" # interfaces with meson-python instead of pip
52+
53+
[tool.pixi.package.run-dependencies]
54+
array-api-compat = "*"
55+
56+
### workspace environments ###
57+
58+
[tool.pixi.environments]
59+
default = { features = ["py313"], solve-group = "py313" }
60+
lint = { features = ["py313", "lint"], solve-group = "py313" }
61+
docs = { features = ["py313", "docs"], solve-group = "py313" }
62+
tests = { features = ["py313", "tests"], solve-group = "py313" }
63+
tests-py313 = { features = ["py313", "tests"], solve-group = "py313" } # alias of tests
64+
65+
# Some backends may pin numpy; use separate solve-group
66+
dev = { features = ["py313", "lint", "tests", "docs", "dev", "backends"], solve-group = "backends" }
67+
tests-backends = { features = ["py313", "tests", "backends"], solve-group = "backends" }
68+
tests-backends-py311 = { features = ["py311", "tests", "backends"] }
69+
70+
# CUDA not available on free github actions and on some developers' PCs
71+
dev-cuda = { features = ["py313", "lint", "tests", "docs", "dev", "backends", "cuda-backends"], solve-group = "cuda" }
72+
tests-cuda = { features = ["py313", "tests", "backends", "cuda-backends"], solve-group = "cuda" }
73+
tests-cuda-py311 = { features = ["py311", "tests", "backends", "cuda-backends"] }
74+
75+
# Ungrouped environments
76+
tests-numpy1 = ["py311", "tests", "numpy1"]
77+
tests-py311 = ["py311", "tests"]
78+
tests-nogil = ["nogil", "tests"]
79+
80+
### default feature definition ###
81+
82+
[tool.pixi.dev]
83+
# this pulls in array-api-extra's host and run dependencies
84+
array-api-extra.path = "."
4885

4986
[tool.pixi.dependencies]
50-
array-api-compat = ">=1.12.0,<2"
87+
array-api-extra.path = "."
5188

52-
[tool.pixi.pypi-dependencies]
53-
array-api-extra = { path = ".", editable = true }
89+
### non-default feature definitions ###
5490

5591
[tool.pixi.feature.lint.dependencies]
5692
typing-extensions = ">=4.15.0"
@@ -197,28 +233,6 @@ dask-core = ">=2025.12.0" # No distributed, tornado, etc.
197233
# sparse = "*" # numba not available on Python 3.13t yet
198234
# jax = "*" # ml_dtypes not available on Python 3.13t yet
199235

200-
[tool.pixi.environments]
201-
default = { features = ["py313"], solve-group = "py313" }
202-
lint = { features = ["py313", "lint"], solve-group = "py313" }
203-
docs = { features = ["py313", "docs"], solve-group = "py313" }
204-
tests = { features = ["py313", "tests"], solve-group = "py313" }
205-
tests-py313 = { features = ["py313", "tests"], solve-group = "py313" } # alias of tests
206-
207-
# Some backends may pin numpy; use separate solve-group
208-
dev = { features = ["py313", "lint", "tests", "docs", "dev", "backends"], solve-group = "backends" }
209-
tests-backends = { features = ["py313", "tests", "backends"], solve-group = "backends" }
210-
tests-backends-py311 = { features = ["py311", "tests", "backends"] }
211-
212-
# CUDA not available on free github actions and on some developers' PCs
213-
dev-cuda = { features = ["py313", "lint", "tests", "docs", "dev", "backends", "cuda-backends"], solve-group = "cuda" }
214-
tests-cuda = { features = ["py313", "tests", "backends", "cuda-backends"], solve-group = "cuda" }
215-
tests-cuda-py311 = { features = ["py311", "tests", "backends", "cuda-backends"] }
216-
217-
# Ungrouped environments
218-
tests-numpy1 = ["py311", "tests", "numpy1"]
219-
tests-py311 = ["py311", "tests"]
220-
tests-nogil = ["nogil", "tests"]
221-
222236
# pytest
223237

224238
[tool.pytest.ini_options]

tests/meson.build

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
py.install_sources([
2+
'__init__.py',
3+
'conftest.py',
4+
'test_at.py',
5+
'test_funcs.py',
6+
'test_helpers.py',
7+
'test_lazy.py',
8+
'test_testing.py',
9+
'test_version.py',
10+
],
11+
subdir: 'array_api_extra/tests',
12+
install_tag: 'tests',
13+
)

vendor_tests/meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
py.install_sources([
2+
'__init__.py',
3+
'_array_api_compat_vendor.py',
4+
'test_vendor.py',
5+
],
6+
subdir: 'array_api_extra/vendor_tests',
7+
install_tag: 'tests',
8+
)

0 commit comments

Comments
 (0)