Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add no-default-feature option #1092

Merged
merged 33 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6eae2b7
Add no-default-feature option
olivier-lacroix Mar 31, 2024
5a578b8
Add test
olivier-lacroix Mar 31, 2024
1801aa5
add to polarify example
olivier-lacroix Apr 1, 2024
63c63ef
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 2, 2024
eb22b4f
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 2, 2024
9169083
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 2, 2024
8bc062c
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 3, 2024
3c6d447
Update docs/configuration.md
olivier-lacroix Apr 3, 2024
aec2a34
fix: polarify example and add a warning.
ruben-arts Apr 3, 2024
cee5942
Merge branch 'main' into nodefaultfeature
tdejager Apr 5, 2024
b015263
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 6, 2024
d85d9af
Start refactoring
olivier-lacroix Apr 6, 2024
6d27c45
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 20, 2024
c9a3dc5
handle defautl inclusion in solve groups
olivier-lacroix Apr 20, 2024
2b11c94
Handle default feature inclusion in GroupedEnvironement
olivier-lacroix Apr 20, 2024
ce3d63e
revert unrelated change
olivier-lacroix Apr 20, 2024
ff03d59
Implement deserialisation logic and tests
olivier-lacroix Apr 20, 2024
d42171e
Update syntax in examples, tests and documentation
olivier-lacroix Apr 20, 2024
dc18fe1
Regenerate schema
olivier-lacroix Apr 20, 2024
271e5ea
switch to a platform selector
olivier-lacroix Apr 20, 2024
9c99598
Improve documentation
olivier-lacroix Apr 20, 2024
e0a7bae
Refactor to leverage Environment methods in SolveGroup
olivier-lacroix Apr 20, 2024
9c51c3a
Rename
olivier-lacroix Apr 21, 2024
86e7789
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 26, 2024
195ae29
Fix resolution of channels for environments
olivier-lacroix Apr 26, 2024
7661d8a
Merge branch 'main' into nodefaultfeature
olivier-lacroix Apr 27, 2024
0414ac2
Revert to boolean no-default-feature
olivier-lacroix Apr 27, 2024
7f93887
Improve documentation
olivier-lacroix Apr 27, 2024
04cdb23
Refactor commonalities between environment, solvegroup and groupedenv…
olivier-lacroix Apr 28, 2024
29b1a6b
feat: change trait name to `HasFeatures`
tdejager Apr 29, 2024
1616205
feat: renamed module
tdejager Apr 29, 2024
550d516
misc: use no-default-feature in pixi itself and add to the docs example
ruben-arts Apr 29, 2024
6d75bf9
fix: revert use of no-default in pixi as this needs to be merged firs…
ruben-arts Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ The `feature` table allows you to define the following fields per feature.
- `pypi-dependencies`: Same as the [pypi-dependencies](#pypi-dependencies-beta-feature).
- `system-requirements`: Same as the [system-requirements](#the-system-requirements-table).
- `activation`: Same as the [activation](#the-activation-table).
- `platforms`: Same as the [platforms](#platforms). When adding features together the intersection of the platforms is taken. Be aware that the `default` feature is always implied thus this must contain all platforms the project can support.
- `channels`: Same as the [channels](#channels). Adding the `priority` field to the channels to allow concatenation of channels instead of overwriting.
- `platforms`: Same as the [platforms](#platforms). Unless overridden, the `platforms` of the feature will be those defined at project level.
- `channels`: Same as the [channels](#channels). Unless overridden, the `channels` of the feature will be those defined at project level.
- `target`: Same as the [target](#the-target-table).
- `tasks`: Same as the [tasks](#the-tasks-table).

Expand Down Expand Up @@ -615,33 +615,45 @@ platforms = ["linux-64", "osx-arm64"]

### The `environments` table

The `environments` table allows you to define environments that are created using the features defined in the `feature` tables.

!!! important
`default` is always implied when creating environments.
If you don't want to use the `default` feature you can keep all the non feature tables empty.
The `[environments]` table allows you to define environments that are created using the features defined in the `[feature]` tables.

The environments table is defined using the following fields:

- `features: Vec<Feature>`: The features that are included in the environment set, which is also the default field in the environments.
- `solve-group: String`: The solve group is used to group environments together at the solve stage.
- `features`: The features that are included in the environment. Unless `no-default-feature` is set to `true`, the default feature is implicitly included in the environment.
- `solve-group`: The solve group is used to group environments together at the solve stage.
This is useful for environments that need to have the same dependencies but might extend them with additional dependencies.
For instance when testing a production environment with additional test dependencies.
These dependencies will then be the same version in all environments that have the same solve group.
But the different environments contain different subsets of the solve-groups dependencies set.
- `no-default-feature`: Whether to include the default feature in that environment. The default is `false`, to include the default feature.

```toml title="Full environments table specification"
[environments]
test = {features = ["test"], solve-group = "test"}
prod = {features = ["prod"], solve-group = "test"}
lint = {features = ["lint"], no-default-feature = true}
```
As shown in the example above, in the simplest of cases, it is possible to define an environment only by listing its features:

```toml title="Simplest example"
[environments]
test = ["test"]
```

```toml title="Full environments table specification"
is equivalent to

```toml title="Simplest example expanded"
[environments]
test = {features = ["test"], solve-group = "test"}
prod = {features = ["prod"], solve-group = "test"}
lint = ["lint"]
test = {features = ["test"]}
```

When an environment comprises several features (including the default feature):
- The `activation` and `tasks` of the environment are the union of the `activation` and `tasks` of all its features.
- The `dependencies` and `pypi-dependencies` of the environment are the union of the `dependencies` and `pypi-dependencies` of all its features. This means that if several features define a requirement for the same package, both requirements will be combined. Beware of conflicting requirements across features added to the same environment.
- The `system-requirements` of the environment is the union of the `system-requirements` of all its features. If multiple features specify a requirement for the same system package, the highest version is chosen.
- The `channels` of the environment is the union of the `channels` of all its features. Channel priorities can be specified in each feature, to ensure channels are considered in the right order in the environment.
- The `platforms` of the environment is the intersection of the `platforms` of all its features. Be aware that the platforms supported by a feature (including the default feature) will be considered as the `platforms` defined at project level (unless overridden in the feature). This means that it is usually a good idea to set the project `platforms` to all platforms it can support across its environments.

## Global configuration

The global configuration options are documented in the [global configuration](../advanced/global_configuration.md) section.
Loading
Loading