Skip to content

Design doc: a more complex, pixi - native when for conditional dependencies #6016

Description

@wolfv

We have discussed (@baszalmstra and me) how to design a pixi-native when (in the context of supporting v3 repodata that includes conditional dependencies). This is especially relevant for pixi-build.

CEP: conda/ceps#164

In the raw matchspec, when can look something like:

foobar [when="python >=3.10"]
foobar [when="python and numpy"]
foobar [when="python or nodejs"]

Where the individual elements fo the expression can be full blown matchspecs again (except nested when is not allowed!).

For a Pixi / TOML native version, we came up with the following idea:

Allow single name, e.g:

foobar = { version = "*", when = "python" }

For more complex matchspec:

foobar = { version = "*", when = { python = ">3.10" } }

To support and / or:

# We use an array, and combine with AND by default (can be made explicit)
foobar = { version = "*", when = [{ python = ">3.10" }, "numpy" ] }
foobar = { version = "*", when = [{ python = ">3.10" }, { numpy = ">2"}] }
foobar = { version = "*", when = [{ python = ">3.10" }, "&&", { numpy = ">2"}] }

# for OR
foobar = { version = "*", when = [{ python = ">3.10" }, "||", { numpy = ">2"}] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions