Skip to content

ENH: Pixi package definitions for downstream development#30381

Merged
seberg merged 7 commits intonumpy:mainfrom
lucascolley:pixi-build
Dec 17, 2025
Merged

ENH: Pixi package definitions for downstream development#30381
seberg merged 7 commits intonumpy:mainfrom
lucascolley:pixi-build

Conversation

@lucascolley
Copy link
Contributor

@lucascolley lucascolley commented Dec 5, 2025

Copy link
Contributor Author

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently separate manifests in different directories are required. This might change in the future pending prefix-dev/pixi#2813.

@lucascolley
Copy link
Contributor Author

@ngoldbaum perhaps you would be interested in making a TSan version based on what I have here? I suppose to test that this is understandable and maintainable.

@charris charris changed the title REL: Pixi package definitions for downstream development ENH: Pixi package definitions for downstream development Dec 5, 2025
@FFY00
Copy link
Contributor

FFY00 commented Dec 5, 2025

@lucascolley, could we extend this to linux-x86_64 too? I feel like if we are gonna upstream the CPython recipes, we would want at least these two platforms. I can help with that if needed 😊

@lucascolley
Copy link
Contributor Author

yes, go for it! I only have an osx-arm64 machine right now (although not really an excuse for linux with docker...) but will have access to a linux and a windows box next week. Feel free to beat me to it ☺️

@ngoldbaum
Copy link
Member

perhaps you would be interested in making a TSan version based on what I have here? I suppose to test that this is understandable and maintainable.

Sure, is there a CPython recipe I should be using? How do I use this recipe with the CPython recipe?

Maybe it'd help to have a README in the new pixi_packages folder that explains to luddites like me how to use the recipes to do useful development tasks.

@lucascolley
Copy link
Contributor Author

I'm figuring out the details for CPython now, will let you know when ready.

@lucascolley lucascolley force-pushed the pixi-build branch 2 times, most recently from 2d36b2b to 9f05918 Compare December 5, 2025 22:50
@charris charris added the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Dec 5, 2025
@charris
Copy link
Member

charris commented Dec 5, 2025

This will need a release note.

@lucascolley
Copy link
Contributor Author

lucascolley commented Dec 5, 2025

@ngoldbaum

Sure, is there a CPython recipe I should be using? How do I use this recipe with the CPython recipe?

I pushed osx-arm64 recipes for default and ASan CPython at lucascolley/cpython@375594b. I have updated this PR so that the NumPy ASan package builds against the CPython ASan package.

Hopefully it is clear how one would go about adding another build type like TSan:

Maybe it'd help to have a README in the new pixi_packages folder that explains to luddites like me how to use the recipes to do useful development tasks.

Development tasks on which repo? For NumPy, we should probably wait until something like https://github.com/scipy/scipy/blob/main/pixi.toml exists, but they could also be added to an out-of-tree workspace like https://github.com/rgommers/pixi-dev-scipystack/blob/main/numpy/pixi.toml.

For SciPy, we should add some docs, yes, and it would probably be sufficient for a README here to link to those docs?

@ngoldbaum
Copy link
Member

For SciPy, we should add some docs, yes, and it would probably be sufficient for a README here to link to those docs?

Sounds reasonable to me.

Thanks so much for working on this. I was hoping you would when you shared all this stuff earlier this year when it was beta.

@lucascolley
Copy link
Contributor Author

my pleasure — it has been super cool to work across both the development and user side of this!

@lucascolley
Copy link
Contributor Author

@FFY00 what information would be good to include on the CPython issue?

@lucascolley
Copy link
Contributor Author

For NumPy, we should probably wait until something like https://github.com/scipy/scipy/blob/main/pixi.toml exists

gh-30387

@lucascolley
Copy link
Contributor Author

lucascolley commented Dec 7, 2025

@FFY00
Copy link
Contributor

FFY00 commented Dec 9, 2025

Sorry for the delay getting back to you.

Thank you so much for all this work, it is extremely helpful!

@FFY00 what information would be good to include on the CPython issue?

I opened an issue at python/cpython#142466. Feel free to send a PR whenever you are ready!

@lucascolley
Copy link
Contributor Author

The CPython PR looks like will be ready soon, I'll give it one week-ish to give time for others to object, but if nobody does, I'll merge it 😃

🎉🎉

Would you have time to address Hugo's comment at python/cpython#142469 (comment) @FFY00 ? I am running out of the ability to justify procrastinating my spare time away on this to myself 😅 .

@FFY00
Copy link
Contributor

FFY00 commented Dec 10, 2025

Done. Could you just confirm the llvm-tools thing on macos, since IIRC you use that platform? Other than that, we are good 👍

@lucascolley
Copy link
Contributor Author

replied at python/cpython#142469 (comment)

@FFY00
Copy link
Contributor

FFY00 commented Dec 10, 2025

All good in CPython, I'll probably merge it on the weekend, or start of next week. Congrats @lucascolley!

Copy link
Contributor Author

@lucascolley lucascolley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO here:

  • README (can borrow from CPython README)
  • CI
  • release note

Seems like we are happy punting Windows down the line

@ngoldbaum
Copy link
Member

Seems like we are happy punting Windows down the line

Yeah that's fine I've never tried to do this exercise with sanitizers on Windows and am not aware of anyone else doing that

@lucascolley
Copy link
Contributor Author

I added a README and a simple CI job which invokes pixi build for each platform and variant.

I also added a release note.

@charris charris removed the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Dec 12, 2025
Comment on lines +38 to +39
- name: Build
run: pixi build --path="pixi-packages/${{ matrix.package_variant }}"
Copy link
Contributor Author

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 install can help avoid too much extra boilerplate?

Copy link
Contributor

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.

@lucascolley lucascolley marked this pull request as ready for review December 15, 2025 14:52
@lucascolley
Copy link
Contributor Author

CI failures look unrelated

@crusaderky
Copy link
Contributor

crusaderky commented Dec 17, 2025

I'm testing asan on my Linux box:

[workspace]
channels = ["conda-forge"]
name = "cpython-pixi-test"
platforms = ["linux-64"]
preview = ["pixi-build"]

[dependencies]
python = { git = "https://github.com/python/cpython", subdirectory = "Tools/pixi-packages/asan" }
numpy = { git = "https://github.com/lucascolley/numpy", rev = "pixi-build", subdirectory = "pixi-packages/asan" }

It works, but it's extremely verbose, producing several hundreds of pages of output. Unsure if they are legit issues with numpy or just noise? Or am I using it incorrectly?

$ pixi s
$ python -c 'import numpy'

[... too many lines of  output to copy-paste. here is just one ...]
Indirect leak of 14 byte(s) in 1 object(s) allocated from:
    #0 0x782aed6fd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x782ae833e896 in PyArrayMethod_FromSpec_int ../numpy/_core/src/multiarray/array_method.c:481
    #2 0x782ae8594f9b in PyUFunc_AddLoopFromSpec_int ../numpy/_core/src/umath/dispatching.cpp:177
    #3 0x782ae86592e8 in init_ufunc(_object*, char const*, PyArray_DTypeMeta**, NPY_CASTING (*)(PyArrayMethodObject_tag*, PyArray_DTypeMeta* const*, _PyArray_Descr* const*, _PyArray_Descr**, long*), int (*)(PyArrayMethod_Context_tag*, char* const*, long const*, long const*, NpyAuxData_tag*), int, int, NPY_CASTING, NPY_ARRAYMETHOD_FLAGS, void*) ../numpy/_core/src/umath/stringdtype_ufuncs.cpp:2492

SUMMARY: AddressSanitizer: 35505 byte(s) leaked in 410 allocation(s).

@lucascolley
Copy link
Contributor Author

@crusaderky
Copy link
Contributor

do you have something like https://github.com/lucascolley/scipy/blob/78445c90e2dc2560d8f6ae044fab0d6d0eaa08ea/pixi.toml#L598

Ah yes, that quiets it down.

Copy link
Member

@seberg seberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, looks good to me (I have not tried it out, but there are no users, so if there are problems follow-ups are easy enough anyway).

I think I'll just put it in, if e.g. Nathan has another comment it is after all easy to follow-up.

Thanks a lot for all this pixi work Lucas!

@seberg
Copy link
Member

seberg commented Dec 17, 2025

Hmmm, fun CI failures. The MacOS ones are spurious matmul runtime warnings, the windows ones looked like new warnings generated by cython code. Retriggered, but just out of curiosity...

@seberg
Copy link
Member

seberg commented Dec 17, 2025

Sorry, nvm. would need a re-base for the new allowed warnings. And that is just not worth it.

@seberg seberg merged commit e8e909f into numpy:main Dec 17, 2025
77 of 83 checks passed
@lucascolley lucascolley deleted the pixi-build branch December 17, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants