Pixi Environments
Programmes change. Few things are as frustrating as coming back to a project after a long time and spending the first {hours, days} updating your code to work with a new version of your favourite data analysis library. The same holds for debugging errors that occur only because your coauthor uses a slightly different setup.
The solution is to have isolated environments on a per-project basis. Pixi environments allow you to do precisely this. This page describes them a little bit and explains their use.
The following commands can either be executed in a terminal or the Powershell (Windows).
Using the environment¶
The templates ship with a pre-configured environment.
You can inspect the contents in the
[tool.pixi.xxx]sections.When you type
pixi run ...orpixi install, the packages are downloaded to the.pixifolder in the project root.
Updating packages¶
Precise versions of packages are pinned down in the file pixi.lock, ensuring
reproducibility. If you want to update a package, make sure that you are in the project
root and run
$ pixi updateto update all packages, or run
$ pixi update [package]to update a specific [package].
Installing additional packages¶
To list installed packages, type
$ pixi listIf you want to add a package to your environment, you can add the package to the
[tool.pixi.dependencies] section in the pyproject.toml file. Alternatively, you can
run
$ pixi add [package]You will notice that the pixi section in the pyproject.toml file is then also updated with the added package.