python-package-guide icon indicating copy to clipboard operation
python-package-guide copied to clipboard

Package & environment manager content -- be clear about how pixi environments work

Open lwasser opened this issue 2 months ago • 0 comments

As is this might not be clear. What I'm trying to convey is that you do

pixi init example && cd example
pixi add numpy
pixi add --pypi scipy

generating

[workspace]
channels = ["conda-forge"]
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
numpy = ">=2.3.4,<3"

[pypi-dependencies]
scipy = ">=1.16.3, <2"

Pixi will get only scipy from PyPI and will use everything else from conda-forge

$ pixi list | grep 'numpy\|scipy'
numpy             2.3.4      py314h2b28147_0       8.5 MiB    conda  https://conda.anaconda.org/conda-forge/
scipy             1.16.3                           112.9 MiB  pypi   scipy-1.16.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

To be clear, that is the same behavior as

conda create --name debug --yes --channel conda-forge numpy pip
conda activate debug
pip install scipy

though it is explicitly understood that Pixi will handle the resolution to use conda packages where it can, and the behavior is fully described in the manifest file and lock file, so there is no ambiguity of how a conda vs. Python package dependency might get resolved at install time.

Originally posted by @matthewfeickert in https://github.com/pyOpenSci/python-package-guide/pull/587#discussion_r2505909845

lwasser avatar Nov 11 '25 15:11 lwasser