In this step, we will create a project that manages conflicting dependencies (Legacy vs Modern) using Pixi Features and Environments.
Initialize a new Pixi project:
pixi initAdd dependencies shared by all environments:
pixi add "python=3.9.*" coloramaFeatures allow you to group dependencies that are essentially "optional" or "variants".
Create a "legacy" feature with older packages:
pixi add --feature legacy "pandas<1.5" "numpy<1.22"Create a "modern" feature with newer packages:
pixi add --feature modern "pandas>=2.0" "numpy>=1.24"Now we need to tell Pixi how to combine these features into environments.
pixi workspace environment add modern --feature modern
pixi workspace environment add legacy --feature legacyNote, your features do not have to have the same name! You can have many features per environment and even have quite complex solve groups. But this is the basic steps.
Now try running the conflicting scripts in their respective environments!
Run Legacy:
pixi run -e legacy python legacy_script.pyRun Modern:
pixi run -e modern python modern_script.pyYou can view the reference configuration in solution.toml.