Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
ENH: Pixi package definitions for downstream development #30381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d17175f
REL: Pixi package definitions for downstream development
lucascolley 21845c5
linux-64 support
lucascolley 6122de6
bump cpython
lucascolley 877dc9b
add README
lucascolley e896ce3
add release note
lucascolley c029904
CI
lucascolley 57d1d7a
Apply suggestion from @lucascolley
lucascolley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Pixi packages tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - maintenance/** | ||
| paths-ignore: | ||
| - '**.pyi' | ||
| - '**.md' | ||
| - '**.rst' | ||
|
|
||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
|
|
||
| jobs: | ||
| build_packages: | ||
| name: Build Pixi packages | ||
| runs-on: ${{ matrix.runs-on }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| runs-on: [ubuntu-latest, macos-15] | ||
| package_variant: [asan, default] | ||
| if: github.repository == 'numpy/numpy' | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| submodules: recursive | ||
| fetch-tags: true | ||
| persist-credentials: false | ||
|
|
||
| - uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1 | ||
| with: | ||
| pixi-version: v0.60.0 | ||
| run-install: false | ||
|
|
||
| - name: Build | ||
| run: pixi build --path="pixi-packages/${{ matrix.package_variant }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
|
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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| [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"] | ||
| compilers = ["c", "cxx"] | ||
|
|
||
| [package.host-dependencies] | ||
| python = "*" | ||
| meson-python = "*" | ||
| cython = "*" | ||
| uv = "*" # used to invoke the wheel build | ||
|
ngoldbaum marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can’t perform that action at this time.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to add anything further to the CI job? Perhaps a sanity check that Python and NumPy at least import?
Not sure how much work that would be, maybe
pixi installcan help avoid too much extra boilerplate?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment - 'python -c 'import numpy'` produces hundreds of pages of output worth of memory leaks, and exits with code 1.