Skip to content

Commit 2bba845

Browse files
docs: update documentation and related manifests (#4279)
Co-authored-by: Lucas Colley <[email protected]>
1 parent d06323c commit 2bba845

File tree

23 files changed

+2907
-2778
lines changed

23 files changed

+2907
-2778
lines changed

docs/build/backends.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ To decouple the building of a conda package from Pixi we provide something what
22
These are essentially executables following a specific protocol that is implemented for both Pixi and the build backend.
33
This also allows for decoupling of the build backend from Pixi and it's manifest specification.
44

5-
The backends we are currently developing are available in the following [conda channel](https://prefix.dev/channels/pixi-build-backends).
6-
And are being developed in the [pixi-build-backends](https://github.com/prefix-dev/pixi-build-backends) repository.
5+
The Prefix.dev managed backends are being developed in the [pixi-build-backends](https://github.com/prefix-dev/pixi-build-backends) repository, and have their own
6+
[documentation](https://prefix-dev.github.io/pixi-build-backends/).
77

88
### Installation
99

10-
When looking at the following build-section:
10+
Install a certain build backend by adding it to the `package.build` section of the manifest file.:
1111

1212
```toml
1313
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:build-system"
1414
```
1515

16-
5. This will allow Pixi to install desired backends from the `pixi-build-backends` channel, and any requirements from `conda-forge`. Backends are installed into isolated environments, and will be shared across Pixi workspaces.
16+
For custom backend channels, you can add the channel to the `channels` section of the manifest file:
17+
```toml
18+
--8<-- "docs/source_files/pixi_tomls/pixi-build-backend-channel.toml:build"
19+
```
20+
1721

1822
### Overriding the Build Backend
1923

20-
Sometimes you want to override the build backend that is used by pixi. Meaning overriding the backend that is specified in the [`[package.build]`](../reference/pixi_manifest.md#the-build-system). We currently have two environment variables that allow for this:
24+
Sometimes you want to override the build backend that is used by pixi. Meaning overriding the backend that is specified in the [`[package.build]`](../reference/pixi_manifest.md#build-table). We currently have two environment variables that allow for this:
2125

2226
1. `PIXI_BUILD_BACKEND_OVERRIDE`: This environment variable allows for overriding of one or multiple backends. Use `{name}={path}` to specify a backend name mapped to a path and `,` to separate multiple backends.
2327
For example: `pixi-build-cmake=/path/to/bin,pixi-build-python` will:

docs/build/workspace.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ Therefore, we can remove the workspace section in the manifest of `cpp_math`.
4848

4949
```diff title="packages/cpp_math/pixi.toml"
5050
-[workspace]
51-
-channels = [
52-
- "https://prefix.dev/pixi-build-backends",
53-
- "https://prefix.dev/conda-forge",
54-
-]
51+
-channels = ["https://prefix.dev/conda-forge"]
5552
-platforms = ["osx-arm64", "osx-64", "linux-64", "win-64"]
5653
-preview = ["pixi-build"]
5754
-

docs/reference/pixi_manifest.md

Lines changed: 101 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -501,29 +501,6 @@ rust = "==1.72"
501501
pytorch-cpu = { version = "~=1.1", channel = "pytorch" }
502502
```
503503

504-
505-
### `host-dependencies`
506-
507-
```toml
508-
[host-dependencies]
509-
python = "~=3.10.3"
510-
```
511-
Typical examples of host dependencies are:
512-
513-
- Base interpreters: a Python package would list `python` here and an R package would list `mro-base` or `r-base`.
514-
- Libraries your workspace links against during compilation like `openssl`, `rapidjson`, or `xtensor`.
515-
516-
### `build-dependencies`
517-
518-
This table contains dependencies that are needed to build the workspace.
519-
Different from `dependencies` and `host-dependencies` these packages are installed for the architecture of the _build_ machine.
520-
This enables cross-compiling from one machine architecture to another.
521-
522-
```toml
523-
[build-dependencies]
524-
cmake = "~=3.24"
525-
```
526-
527504
### `pypi-dependencies`
528505

529506
??? info "Details regarding the PyPI integration"
@@ -915,55 +892,127 @@ An example of a preview feature in the manifest:
915892

916893
Preview features in the documentation will be marked as such on the relevant pages.
917894

918-
## Pixi Build
919895

920-
Pixi build is an experimental feature that requires `preview = ["pixi-build"]` to be set in `[workspace]`
896+
## The `package` section
921897

922-
### Workspace section
923-
924-
Currently, `workspace` is an alias for `project` and we recommend using `workspace` instead of `project`,
925-
when making use of the `pixi-build` preview feature.
926-
To use this keyword the preview feature *does not* need to be enabled, but for now we do recommend it for that use-case solely.
927-
928-
### Package section
898+
!!! warning "Important note"
899+
`pixi-build` is a [preview feature](#preview-features), and will change until it is stabilized.
900+
Please keep that in mind when you use it for your workspaces.
901+
```toml
902+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:preview"
903+
```
929904

930-
The package section is used to define the package that is built by the project.
931-
Pixi only allows this table if `preview = ["pixi-build"]` is set in `[workspace]`.
905+
The package section can be added
906+
to a workspace manifest to define the package that is built by Pixi.
932907

933-
```toml
934-
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:package"
935-
```
908+
A package section needs to be inside a `workspace`,
909+
either in the same manifest file as the `[workspace]` table or in a sub folder `pixi.toml`/`pyproject.toml` file.
936910

937-
### Host, Build, dependencies
911+
These packages will be built into a conda package that can be installed into a conda environment.
912+
The package section is defined using the following fields:
938913

939-
The package section re-uses the `host-dependencies` and `build-dependencies`,
940-
which you can read about here: [host-build-dependencies](#host-dependencies) and [build-dependencies](#build-dependencies).
941-
If you have the `preview = ["pixi-build"]` enabled these are interpreted as part of the package.
914+
- `name`: The name of the package.
915+
- `version`: The version of the package.
916+
- `build`: The build system used to build the package.
917+
- `build-dependencies`: The build dependencies of the package.
918+
- `host-dependencies`: The host dependencies of the package.
919+
- `run-dependencies`: The run dependencies of the package.
920+
- `target`: The target table to configure target specific dependencies. (Similar to the [target](#the-target-table) table)
942921

943-
### Run dependencies
922+
And to extend the basics, it can also contain the following fields:
944923

945-
Run dependencies are dependencies that are required at runtime by your package.
946-
For Python packages, these are the most common dependency types.
947-
For compiled languages, these are less common and would basically be dependencies that you do not need when compiling the package but are needed when running it.
924+
- `description`: A short description of the package.
925+
- `authors`: A list of authors of the package.
926+
- `license`: The license of the package.
927+
- `license-file`: The license file of the package.
928+
- `readme`: The README file of the package.
929+
- `homepage`: The homepage link of the package.
930+
- `repository`: The repository link of the package.
931+
- `documentation`: The documentation link of the package.
948932

949933
```toml
950-
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:run-dependencies"
934+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:package"
935+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:extra-fields"
951936
```
952937

953-
### The `build-system`
938+
!!! note "Workspace inheritance"
939+
Most extra fields can be inherited from the workspace manifest.
940+
This means that you can define the `description`, `authors`, `license` in the workspace manifest, and they will be inherited by the package manifest.
941+
```toml
942+
[workspace]
943+
name = "my-workspace"
944+
945+
[package]
946+
name = { workspace = true } # Inherit the name from the workspace
947+
```
948+
949+
### `build` table
954950

955951
The build system specifies how the package can be built.
956952
The build system is a table that can contain the following fields:
957953

958954
- `channels`: specifies the channels to get the build backend from.
959-
- `build-backend`: specifies the build backend to use. This is a table that can contain the following fields:
955+
- `backend`: specifies the build backend to use. This is a table that can contain the following fields:
960956
- `name`: the name of the build backend to use. This will also be the executable name.
961957
- `version`: the version of the build backend to use.
958+
- `configuration`: a table that contains the configuration options for the build backend.
959+
- `target`: a table that can contain target specific build configuration.
960+
961+
More documentation on the backends can be found in the [build backend documentation](../build/backends.md).
962962

963963
```toml
964-
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:build-system"
964+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:build-system"
965965
```
966966

967-
!!! note
968-
We are currently not publishing the backends on conda-forge, but will do so in the future.
969-
For now the backends are published at [conda channel](https://prefix.dev/channels/pixi-build-backends).
967+
968+
### The `build` `host` and `run` dependencies tables
969+
The dependencies of a package are split into three tables.
970+
Each of these tables has a different purpose and is used to define the dependencies of the package.
971+
972+
- [`build-dependencies`](#build-dependencies): Dependencies that are required to build the package on the build platform.
973+
- [`host-dependencies`](#host-dependencies): Dependencies that are required during the build process, to link against the package on the target platform.
974+
- [`run-dependencies`](#run-dependencies): Dependencies that are required to run the package on the target platform.
975+
976+
977+
### `build-dependencies`
978+
Build dependencies are required in the build environment and contain all tools that are not needed on the host of the package.
979+
980+
Following packages are examples of typical build dependencies:
981+
982+
- compilers (`gcc`, `clang`, `gfortran`)
983+
- build tools (`cmake`, `ninja`, `meson`)
984+
- `make`
985+
- `pkg-config`
986+
- VSC packages (`git`, `svn`)
987+
988+
```toml
989+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:build-dependencies"
990+
```
991+
992+
### `host-dependencies`
993+
994+
Host dependencies are required during build phase, but in contrast to build packages they have to be present on the host.
995+
996+
Following packages are typical examples for host dependencies:
997+
998+
- shared libraries (c/c++)
999+
- python/r libraries that link against c libraries
1000+
- `python`, `r-base`
1001+
- `setuptools`, `pip`
1002+
1003+
```toml
1004+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:host-dependencies"
1005+
```
1006+
1007+
### `run-dependencies`
1008+
The `run-dependencies` are the packages that will be installed in the environment when the package is run.
1009+
1010+
- Libraries
1011+
- Extra data file packages
1012+
- Python/R packages that are not needed during build time
1013+
1014+
```toml
1015+
--8<-- "docs/source_files/pixi_tomls/pixi-package-manifest.toml:run-dependencies"
1016+
```
1017+
1018+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DUMMY FOR PARSING

docs/source_files/pixi_tomls/dependency_types.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ name = "simple_cpp"
88
version = "0.1.0"
99

1010
[package.build]
11-
backend = { name = "pixi-build-cmake", version = "0.1.*" }
12-
channels = [
13-
"https://prefix.dev/pixi-build-backends",
14-
"https://prefix.dev/conda-forge",
15-
]
11+
backend = { name = "pixi-build-cmake", version = "0.3.*" }
1612
# --8<-- [start:dependencies]
1713
[package.build-dependencies]
1814
cxx-compiler = "*"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[workspace]
2+
channels = []
3+
platforms = []
4+
preview = ["pixi-build"]
5+
6+
# --8<-- [start:build]
7+
[package.build]
8+
backend = { name = "pixi-build-python", version = "==0.3.2" }
9+
channels = [
10+
"https://prefix.dev/pixi-build-backends",
11+
"https://prefix.dev/conda-forge",
12+
]
13+
# --8<-- [end:build]
14+
[package]
15+
name = "pixi-build-backend-channel"
16+
version = "0.1.0"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# --8<-- [start:package]
2+
[package]
3+
name = "package"
4+
version = "0.1.0"
5+
# --8<-- [end:package]
6+
# --8<-- [start:extra-fields]
7+
authors = ["Author Name <[email protected]>"]
8+
description = "A package description"
9+
documentation = "https://docs.example.com"
10+
homepage = "https://example.com"
11+
license = "MIT"
12+
license-file = "LICENSE"
13+
readme = "README.md"
14+
repository = "https://github.com/user/repo"
15+
# --8<-- [end:extra-fields]
16+
17+
# --8<-- [start:build-system]
18+
[package.build]
19+
backend = { name = "pixi-build-cmake", version = "0.3.*" }
20+
# not required:
21+
channels = ["https://prefix.dev/conda-forge"]
22+
configuration = { key = "value" } # Optional configuration, specific to the build backend
23+
# --8<-- [end:build-system]
24+
25+
26+
# --8<-- [start:build-dependencies]
27+
[package.build-dependencies]
28+
cmake = "*"
29+
git = "*"
30+
31+
# --8<-- [end:build-dependencies]
32+
33+
# --8<-- [start:host-dependencies]
34+
[package.host-dependencies]
35+
python = "*"
36+
# --8<-- [end:host-dependencies]
37+
38+
# --8<-- [start:run-dependencies]
39+
[package.run-dependencies]
40+
rich = ">=13.9.4,<14"
41+
# --8<-- [end:run-dependencies]
42+
43+
44+
[workspace]
45+
channels = ["https://prefix.dev/conda-forge"]
46+
platforms = ["osx-arm64", "osx-64", "linux-64", "win-64"]
47+
preview = ["pixi-build"]

docs/source_files/pixi_tomls/simple_pixi_build.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ version = "0.1.0"
1919
# We are using `pixi-build-python` in order to build a Python package
2020
# --8<-- [start:build-system]
2121
[package.build]
22-
backend = { name = "pixi-build-python", version = "0.1.*" }
23-
channels = [
24-
"https://prefix.dev/pixi-build-backends",
25-
"https://prefix.dev/conda-forge",
26-
]
22+
backend = { name = "pixi-build-python", version = "==0.3.2" }
2723
# --8<-- [end:build-system]
2824

2925

0 commit comments

Comments
 (0)