Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8e909f

Browse files
authored
ENH: Pixi package definitions for downstream development (#30381)
Add Pixi package definitions for downstream development
1 parent 62a4925 commit e8e909f

5 files changed

Lines changed: 134 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Pixi packages tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- maintenance/**
8+
paths-ignore:
9+
- '**.pyi'
10+
- '**.md'
11+
- '**.rst'
12+
13+
permissions:
14+
contents: read # to fetch code (actions/checkout)
15+
16+
jobs:
17+
build_packages:
18+
name: Build Pixi packages
19+
runs-on: ${{ matrix.runs-on }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
runs-on: [ubuntu-latest, macos-15]
24+
package_variant: [asan, default]
25+
if: github.repository == 'numpy/numpy'
26+
steps:
27+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
with:
29+
submodules: recursive
30+
fetch-tags: true
31+
persist-credentials: false
32+
33+
- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
34+
with:
35+
pixi-version: v0.60.0
36+
run-install: false
37+
38+
- name: Build
39+
run: pixi build --path="pixi-packages/${{ matrix.package_variant }}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Pixi package definitions
2+
------------------------
3+
Pixi package definitions have been added for different kinds
4+
of from-source builds of NumPy. These can be used in
5+
downstream Pixi workspaces via the ``pixi-build`` feature.
6+
7+
Definitions for both ``default`` and AddressSanitizer-instrumented
8+
(``asan``) builds are available in the source code under the
9+
``pixi-packages/`` directory.
10+
11+
``linux-64`` and ``osx-arm64`` platforms are supported.

pixi-packages/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# CPython Pixi packages
2+
3+
This directory contains definitions for [Pixi packages](https://pixi.sh/latest/reference/pixi_manifest/#the-package-section)
4+
which can be built from the NumPy source code.
5+
6+
Downstream developers can make use of these packages by adding them as Git dependencies in a
7+
[Pixi workspace](https://pixi.sh/latest/first_workspace/), like:
8+
9+
```toml
10+
[dependencies]
11+
numpy = { git = "https://github.com/numpy/numpy", subdirectory = "pixi-packages/asan" }
12+
```
13+
14+
This is particularly useful when developers need to build NumPy from source
15+
(for example, for an ASan-instrumented build), as it does not require any manual
16+
clone or build steps. Instead, Pixi will automatically handle both the build
17+
and installation of the package.
18+
19+
See https://github.com/scipy/scipy/pull/24066 for a full example of downstream use.
20+
21+
Each package definition is contained in a subdirectory.
22+
Currently defined package variants:
23+
24+
- `default`
25+
- `asan`: ASan-instrumented build with `-Db_sanitize=address`
26+
27+
## Maintenance
28+
29+
- Keep host dependency requirements up to date
30+
- For dependencies on upstream CPython Pixi packages, keep the git revision at a compatible version
31+
32+
## Opportunities for future improvement
33+
34+
- More package variants (such as TSan, UBSan)
35+
- Support for Windows
36+
- Using a single `pixi.toml` for all package variants is blocked on https://github.com/prefix-dev/pixi/issues/2813
37+
- Consider pinning dependency versions to guard against upstream breakages over time

pixi-packages/asan/pixi.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["osx-arm64", "linux-64"]
4+
preview = ["pixi-build"]
5+
6+
[package.build]
7+
source.path = "../.."
8+
9+
[package.build.backend]
10+
name = "pixi-build-python"
11+
version = "*"
12+
13+
[package.build.config]
14+
extra-input-globs = ["**/*.c.src"]
15+
compilers = ["c", "cxx"]
16+
env.ASAN_OPTIONS = "detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:use_sigaltstack=0"
17+
extra-args = ["-Csetup-args=-Db_sanitize=address", "-Csetup-args=-Dbuildtype=debug"]
18+
19+
[package.host-dependencies]
20+
python.git = "https://github.com/python/cpython"
21+
python.subdirectory = "Tools/pixi-packages/asan"
22+
python.rev = "8bb5b6e8ce61da41b5affd5eb12d9cc46b5af448"
23+
24+
meson-python = "*"
25+
cython = "*"
26+
uv = "*" # used to invoke the wheel build

pixi-packages/default/pixi.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
platforms = ["osx-arm64", "linux-64"]
4+
preview = ["pixi-build"]
5+
6+
[package.build]
7+
source.path = "../.."
8+
9+
[package.build.backend]
10+
name = "pixi-build-python"
11+
version = "*"
12+
13+
[package.build.config]
14+
extra-input-globs = ["**/*.c.src"]
15+
compilers = ["c", "cxx"]
16+
17+
[package.host-dependencies]
18+
python = "*"
19+
meson-python = "*"
20+
cython = "*"
21+
uv = "*" # used to invoke the wheel build

0 commit comments

Comments
 (0)