-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
gh-142466: Pixi package definitions for downstream use #142469
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
Changes from 6 commits
375594b
54274f2
67cd009
6c47ff1
ad7a35f
b49095c
4d0983e
453e9ee
21353f2
c437bc3
d3566a5
9c811e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ gmon.out | |
| .pytest_cache/ | ||
| .ruff_cache/ | ||
| .DS_Store | ||
| .pixi/ | ||
|
|
||
| *.exe | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ## CPython Pixi Packages | ||
|
StanFromIreland marked this conversation as resolved.
Outdated
|
||
|
|
||
| This directory contains definitions for [Pixi packages](https://pixi.sh/latest/reference/pixi_manifest/#the-package-section) | ||
| which can be built from the CPython 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] | ||
| python = { git = "https://github.com/python/cpython", subdirectory = "Tools/pixi-packages/asan" } | ||
| ``` | ||
|
|
||
| This is particularly useful when developers need to build CPython from source | ||
| (for example, for an ASan-instrumented build), as it does not require any manual | ||
| cloning or building steps. Instead, Pixi will automatically handle both the building | ||
| and installation of the package. | ||
|
|
||
| Each package definition is contained in a subdirectory, but they share the build script | ||
| `build.sh` in this directory. Currently defined package variants: | ||
|
|
||
| - `default` | ||
| - `asan`: ASan-instrumented build with `PYTHON_ASAN=1` | ||
|
|
||
| ### Maintenance | ||
|
|
||
| - the `version` fields in each `recipe.yaml` should be kept up to date with the Python version | ||
| - dependency requirements should be kept up to date in each `recipe.yaml` | ||
| - `build.sh` should be updated for any breaking changes in the `configure` and `make` workflow | ||
|
|
||
| ### Opportunities for future improvement | ||
|
|
||
| - more package variants (e.g. TSan, UBSan) | ||
| - support for Windows | ||
| - using a single `pixi.toml` and `recipe.yaml` for all package variants is blocked on https://github.com/prefix-dev/pixi/issues/4599 | ||
| - a workaround can be removed from the build script once https://github.com/prefix-dev/rattler-build/issues/2012 is resolved | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [workspace] | ||
| channels = ["https://prefix.dev/conda-forge"] | ||
| platforms = ["osx-arm64", "linux-64"] | ||
| preview = ["pixi-build"] | ||
|
|
||
| [package.build.backend] | ||
| name = "pixi-build-rattler-build" | ||
| version = "*" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||||
| context: | ||||||
| # XXX: keep up to date | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re: https://discuss.python.org/t/cryptic-sequences-in-comments/38694 Can we replace all the "XXX" with "TODO" or something else? Maybe we don't even need it here:
Suggested change
If we do merge this, we have code in https://github.com/python/release-tools which is run during the first beta, when
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://rattler-build.prefix.dev/latest/experimental_features/#load_from_filefile_path may remove the need for this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a YAML, TOML, or JSON file that contains the version @hugovk ? If not, could we add one?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There isn't. Yes we can add one, it removes duplication here, and will be easier to programmatically update such a file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any preference for format / location / name?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed this because it was marked as resolved but I don't think it has been :) Format: TOML or JSON, we can read using the stdlib. Location: Name: Hmm,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it was resolved for this PR via the third paragraph of #142469 (review)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, thanks! |
||||||
| version: "3.15" | ||||||
|
|
||||||
| package: | ||||||
| name: python | ||||||
| version: ${{ version }} | ||||||
|
|
||||||
| source: | ||||||
| - path: ../../.. | ||||||
|
|
||||||
| build: | ||||||
| files: | ||||||
| exclude: | ||||||
| - "*.o" | ||||||
| script: | ||||||
| file: ../build.sh | ||||||
| env: | ||||||
| PYTHON_VARIANT: "asan" | ||||||
|
|
||||||
| # XXX: maybe not all requirements necessary | ||||||
|
FFY00 marked this conversation as resolved.
Outdated
lucascolley marked this conversation as resolved.
Outdated
|
||||||
| # derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml | ||||||
| requirements: | ||||||
|
lucascolley marked this conversation as resolved.
Outdated
|
||||||
| build: | ||||||
| - ${{ compiler('c') }} | ||||||
| - ${{ compiler('cxx') }} | ||||||
| - make | ||||||
| - libtool | ||||||
|
lucascolley marked this conversation as resolved.
Outdated
|
||||||
| - pkg-config | ||||||
| # configure script looks for llvm-ar for lto | ||||||
| - if: osx | ||||||
| then: | ||||||
| - llvm-tools | ||||||
|
FFY00 marked this conversation as resolved.
|
||||||
| - if: linux | ||||||
| then: | ||||||
| - ld_impl_${{ target_platform }} | ||||||
| - binutils_impl_${{ target_platform }} | ||||||
| - clang-19 | ||||||
| - llvm-tools-19 | ||||||
|
|
||||||
| host: | ||||||
| - bzip2 | ||||||
| - sqlite | ||||||
| - liblzma-devel | ||||||
| - zlib | ||||||
| - zstd | ||||||
| - openssl | ||||||
| - readline | ||||||
| - tk | ||||||
| # These two are just to get the headers needed for tk.h, but is unused | ||||||
| - xorg-libx11 | ||||||
| - xorg-xorgproto | ||||||
| - ncurses | ||||||
| - libffi | ||||||
| - if: linux | ||||||
| then: | ||||||
| - ld_impl_${{ target_platform }} | ||||||
| - libuuid | ||||||
| - libmpdec-devel | ||||||
| - expat | ||||||
|
|
||||||
| about: | ||||||
| homepage: https://www.python.org/ | ||||||
| license: Python-2.0 | ||||||
| license_file: LICENSE | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [[ "${PYTHON_VARIANT}" == "asan" ]]; then | ||
| echo "BUILD TYPE: ASAN" | ||
| BUILD_DIR="../build_asan" | ||
| CONFIGURE_EXTRA="--with-address-sanitizer" | ||
| export PYTHON_ASAN="1" | ||
| export ASAN_OPTIONS="strict_init_order=true" | ||
| else | ||
| echo "BUILD TYPE: DEFAULT" | ||
| BUILD_DIR="../build" | ||
| CONFIGURE_EXTRA="" | ||
| fi | ||
|
|
||
| mkdir -p "${BUILD_DIR}" | ||
| cd "${BUILD_DIR}" | ||
|
|
||
| if [[ -f configure-done ]]; then | ||
| echo "Skipping configure step, already done." | ||
|
FFY00 marked this conversation as resolved.
|
||
| else | ||
| "${SRC_DIR}/configure" \ | ||
| --prefix="${PREFIX}" \ | ||
| --oldincludedir="${BUILD_PREFIX}/${HOST}/sysroot/usr/include" \ | ||
| --enable-shared \ | ||
| --srcdir="${SRC_DIR}" \ | ||
| ${CONFIGURE_EXTRA} | ||
| fi | ||
|
|
||
| touch configure-done | ||
|
|
||
| make -j"${CPU_COUNT}" install | ||
| ln -sf "${PREFIX}/bin/python3" "${PREFIX}/bin/python" | ||
|
|
||
| # https://github.com/prefix-dev/rattler-build/issues/2012 | ||
| if [[ ${OSTYPE} == "darwin"* ]]; then | ||
| cp "${BUILD_PREFIX}/lib/clang/21/lib/darwin/libclang_rt.asan_osx_dynamic.dylib" "${PREFIX}/lib/libclang_rt.asan_osx_dynamic.dylib" | ||
| fi | ||
|
lucascolley marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [workspace] | ||
| channels = ["https://prefix.dev/conda-forge"] | ||
| platforms = ["osx-arm64", "linux-64"] | ||
| preview = ["pixi-build"] | ||
|
|
||
| [package.build.backend] | ||
| name = "pixi-build-rattler-build" | ||
| version = "*" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| context: | ||
| # XXX: keep up to date | ||
|
lucascolley marked this conversation as resolved.
Outdated
|
||
| version: "3.15" | ||
|
|
||
| package: | ||
| name: python | ||
| version: ${{ version }} | ||
|
|
||
| source: | ||
| - path: ../../.. | ||
|
|
||
| build: | ||
| files: | ||
| exclude: | ||
| - "*.o" | ||
| script: | ||
| file: ../build.sh | ||
|
|
||
| # XXX: maybe not all requirements necessary | ||
|
lucascolley marked this conversation as resolved.
Outdated
lucascolley marked this conversation as resolved.
Outdated
|
||
| # derived from https://github.com/conda-forge/python-feedstock/blob/main/recipe/meta.yaml | ||
| requirements: | ||
| build: | ||
| - ${{ compiler('c') }} | ||
| - ${{ compiler('cxx') }} | ||
| - make | ||
| - libtool | ||
|
lucascolley marked this conversation as resolved.
Outdated
|
||
| - pkg-config | ||
| # configure script looks for llvm-ar for lto | ||
| - if: osx | ||
| then: | ||
| - llvm-tools | ||
| - if: linux | ||
| then: | ||
| - ld_impl_${{ target_platform }} | ||
| - binutils_impl_${{ target_platform }} | ||
| - clang-19 | ||
| - llvm-tools-19 | ||
|
|
||
| host: | ||
| - bzip2 | ||
| - sqlite | ||
| - liblzma-devel | ||
| - zlib | ||
| - zstd | ||
| - openssl | ||
| - readline | ||
| - tk | ||
| # These two are just to get the headers needed for tk.h, but is unused | ||
| - xorg-libx11 | ||
| - xorg-xorgproto | ||
| - ncurses | ||
| - libffi | ||
| - if: linux | ||
| then: | ||
| - ld_impl_${{ target_platform }} | ||
| - libuuid | ||
| - libmpdec-devel | ||
| - expat | ||
|
|
||
| about: | ||
| homepage: https://www.python.org/ | ||
| license: Python-2.0 | ||
| license_file: LICENSE | ||
Uh oh!
There was an error while loading. Please reload this page.