ConfigurationLearn what you can do in the `pixi.toml` configuration.
Danger
This is the old documentation website please visit the new site
The pixi.toml
is the pixi project configuration file, also known as the project manifest.
A toml
file is structured in different tables.
This document will explain the usage of the different tables.
For more technical documentation check crates.io.
The project
table
The minimally required information in the project
table is:
name
The name of the project.
version
(optional)
The version of the project. This should be a valid version based on the conda Version Spec. See the version documentation, for an explanation of what is allowed in a Version Spec.
authors
This is a list of authors of the project.
channels
This is a list that defines the channels used to fetch the packages from.
If you want to use channels hosted on anaconda.org
you only need to use the name of the channel directly.
Channels situated on the file system are also supported with file paths:
To access private or public channels on prefix.dev or Quetz use the url including the hostname:
platforms
Defines the list of platforms that the project supports.
Pixi solves the dependencies for all these platforms and puts them in the lockfile (pixi.lock
).
The available platforms are listed here: link
description
(optional)
This should contain a short description of the project.
license
(optional)
The license as a valid SPDX string (e.g. MIT AND Apache-2.0)
license-file
(optional)
Relative path to the license file.
readme
(optional)
Relative path to the README file.
homepage
(optional)
URL of the project homepage.
repository
(optional)
URL of the project source repository.
documentation
URL of the project documentation.
The tasks
table
Tasks are a way to automate certain custom commands in your project.
For example, a lint
or format
step.
Tasks in a pixi project are essentially cross-platform shell commands, with a unified syntax across platforms.
For more in-depth information, check the Advanced tasks documentation.
Pixi's tasks are run in a pixi environment using pixi run
and are executed using the deno_task_shell
.
You can modify this table using pixi task
.
Note
Specify different tasks for different platforms using the target table
The system-requirements
table
The system requirements are used to define minimal system specifications used during dependency resolution. For example, we can define a unix system with a specific minimal libc version. This will be the minimal system specification for the project. System specifications are directly related to the virtual packages.
Currently, the specified defaults are the same as conda-lock's implementation:
Only if a project requires a different set should you define them.
For example, when installing environments on old versions of linux. You may encounter the following error:
× The current system has a mismatching virtual package. The project requires '__linux' to be at least version '5.10' but the system has version '4.12.14'
This suggests that the system requirements for the project should be lowered. To fix this, add the following table to your configuration:
[system-requirements]
linux = "4.12.14"
The dependencies
table(s)
This section defines what dependencies you would like to use for your project.
There are multiple dependencies tables.
The default is [dependencies]
, which are dependencies that are shared across platforms.
Dependencies are defined using a VersionSpec.
A VersionSpec
combines a Version with an optional operator.
Some examples are:
Tip
The dependencies can be easily added using the pixi add
command line.
Running add
for an existing dependency will replace it with the newest it can use.
Note
To specify different dependencies for different platforms use the target table
dependencies
Add any conda package dependency that you want to install into the environment.
Don't forget to add the channel to the project table should you use anything different than conda-forge
.
Note
All packages added to the dependencies
table are also included as dependencies of the binary build by pixi build
.
To only include certain packages in different stages of the build see build-dependencies
and host-dependencies
.
host-dependencies
This table contains dependencies that are needed to build your project but which should not be included when your project is installed as part of another project. In other words, these dependencies are available during the build but are no longer available when your project is installed. Dependencies listed in this table are installed for the architecture of the target machine.
Typical examples of host dependencies are:
- Base interpreters: a Python package would list
python
here and an R package would listmro-base
orr-base
. - Libraries your project links against during compilation like
openssl
,rapidjson
, orxtensor
.
build-dependencies
This table contains dependencies that are needed to build the project.
Different from dependencies
and host-dependencies
these packages are installed for the architecture of the build machine.
This enables cross-compiling from one machine architecture to another.
Typical examples of build dependencies are:
- Compilers are invoked on the build machine, but they generate code for the target machine. If the project is cross-compiled, the architecture of the build and target machine might differ.
cmake
is invoked on the build machine to generate additional code- or project-files which are then include in the compilation process.
Info
The build target refers to the machine that will execute the build. Programs and libraries installed by these dependencies will be executed on the build machine.
For example, if you compile on a MacBook with an Apple Silicon chip but target Linux x86_64 then your build platform is osx-arm64
and your host platform is linux-64
.
The activation
table
If you want to run an activation script inside the environment when either doing a pixi run
or pixi shell
these can be defined here.
The scripts defined in this table will be sourced when the environment is activated using pixi run
or pixi shell
Note
Specify different scripts for different platforms using the target table
The target
table
The target table is a table that allows for platform specific configuration. Allowing you to make different sets of tasks or dependencies per platform.
The target table is currently implemented for the following sub-tables:
The target table is defined using [target.PLATFORM.SUB-TABLE]
.
E.g [target.linux-64.dependencies]
The platform can be any of the target platforms but must also be defined there.
The sub-table can be any of the specified above.
To make it a bit more clear, let's look at an example below.
Currently, pixi combines the top level tables like dependencies
with the target-specific ones into a single set.
Which, in the case of dependencies, can both add or overwrite dependencies.
In the example below, we have cmake
being used for all targets but on osx-64
a different version of python will be selected.
Here are some more examples: