ENH: Pixi package definitions for downstream development by lucascolley · Pull Request #30381 · numpy/numpy · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/pixi-packages.yml
11 changes: 11 additions & 0 deletions doc/release/upcoming_changes/30381.new_feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Pixi package definitions
------------------------
Pixi package definitions have been added for different kinds
of from-source builds of NumPy. These can be used in
downstream Pixi workspaces via the ``pixi-build`` feature.

Definitions for both ``default`` and AddressSanitizer-instrumented
(``asan``) builds are available in the source code under the
``pixi-packages/`` directory.

``linux-64`` and ``osx-arm64`` platforms are supported.
37 changes: 37 additions & 0 deletions pixi-packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CPython Pixi packages

This directory contains definitions for [Pixi packages](https://pixi.sh/latest/reference/pixi_manifest/#the-package-section)
which can be built from the NumPy source code.

Downstream developers can make use of these packages by adding them as Git dependencies in a
[Pixi workspace](https://pixi.sh/latest/first_workspace/), like:

```toml
[dependencies]
numpy = { git = "https://github.com/numpy/numpy", subdirectory = "pixi-packages/asan" }
```

This is particularly useful when developers need to build NumPy from source
(for example, for an ASan-instrumented build), as it does not require any manual
clone or build steps. Instead, Pixi will automatically handle both the build
and installation of the package.

See https://github.com/scipy/scipy/pull/24066 for a full example of downstream use.

Each package definition is contained in a subdirectory.
Currently defined package variants:

- `default`
- `asan`: ASan-instrumented build with `-Db_sanitize=address`

## Maintenance

- Keep host dependency requirements up to date
- For dependencies on upstream CPython Pixi packages, keep the git revision at a compatible version

## Opportunities for future improvement

- More package variants (such as TSan, UBSan)
- Support for Windows
- Using a single `pixi.toml` for all package variants is blocked on https://github.com/prefix-dev/pixi/issues/2813
- Consider pinning dependency versions to guard against upstream breakages over time
26 changes: 26 additions & 0 deletions pixi-packages/asan/pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[workspace]
channels = ["https://prefix.dev/conda-forge"]
platforms = ["osx-arm64", "linux-64"]
preview = ["pixi-build"]

[package.build]
source.path = "../.."

[package.build.backend]
name = "pixi-build-python"
version = "*"

[package.build.config]
extra-input-globs = ["**/*.c.src"]
Comment thread
lucascolley marked this conversation as resolved.
compilers = ["c", "cxx"]
env.ASAN_OPTIONS = "detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:use_sigaltstack=0"
extra-args = ["-Csetup-args=-Db_sanitize=address", "-Csetup-args=-Dbuildtype=debug"]

[package.host-dependencies]
python.git = "https://github.com/python/cpython"
python.subdirectory = "Tools/pixi-packages/asan"
python.rev = "8bb5b6e8ce61da41b5affd5eb12d9cc46b5af448"

meson-python = "*"
cython = "*"
uv = "*" # used to invoke the wheel build
21 changes: 21 additions & 0 deletions pixi-packages/default/pixi.toml
Loading