Skip to content

Commit c464ed7

Browse files
authored
docs: build backend docs (#2844)
1 parent 13121ba commit c464ed7

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

docs/build/backends.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
To decouple the building of a conda package from pixi we provide something what are called build backends.
2+
These are essentially executables following a specific protocol that is implemented for both pixi and the build backend.
3+
This also allows for decoupling of the build backend from pixi and it's manifest specification.
4+
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.
7+
8+
### Installation
9+
When looking at the following build-section:
10+
11+
```toml
12+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:build-system"
13+
```
14+
15+
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 projects.
16+
17+
### Overriding the Build Backend
18+
Sometimes you want to override the build backend that is used by pixi. Meaning overriding the backend that is specified in the [`[build-system]`](../reference/pixi_manifest.md#the-build-system). We currently have two environment variables that allow for this:
19+
20+
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.
21+
For example: `pixi-build-cmake=/path/to/bin,pixi-build-python` will:
22+
1. override the `pixi-build-cmake` backend with the executable located at `/path/to/bin`
23+
2. and will use the `pixi-build-python` backend from the `PATH`.
24+
2. `PIXI_BUILD_BACKEND_OVERRIDE_ALL`: If this environment variable is set to *some* value e.g `1` or `true`, it will not install any backends in isolation and will assume that all backends are overridden and available in the `PATH`. This is useful for development purposes. e.g `PIXI_BUILD_BACKEND_OVERRIDE_ALL=1 pixi install`

docs/reference/pixi_manifest.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -797,12 +797,8 @@ Pixi sometimes introduces new features that are not yet stable, but that we woul
797797

798798
An example of a preview feature in the project manifest:
799799

800-
```toml title="pixi.toml"
801-
[workspace]
802-
name = "foo"
803-
channels = []
804-
platforms = []
805-
preview = ["pixi-build"]
800+
```toml
801+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:preview"
806802
```
807803

808804
Preview features in the documentation will be marked as such on the relevant pages.
@@ -823,8 +819,7 @@ The package section is used to define the package that is built by the project.
823819
Pixi only allows this table if `preview = ["pixi-build"]` is set in `[workspace]`.
824820

825821
```toml
826-
[package]
827-
version = "1.0.0"
822+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:package"
828823
```
829824

830825
### Host, Build, dependencies
@@ -840,8 +835,7 @@ For Python packages, these are the most common dependency types.
840835
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.
841836

842837
```toml
843-
[package.run-dependencies]
844-
rich = "*"
838+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:run-dependencies"
845839
```
846840

847841
### The `build-system`
@@ -855,14 +849,9 @@ The build system is a table that can contain the following fields:
855849
- `version`: the version of the build backend to use.
856850

857851
```toml
858-
[build-system] # (5)!
859-
build-backend = { name = "pixi-build-python", version = "*" }
860-
channels = [
861-
"https://prefix.dev/pixi-build-backends",
862-
"https://prefix.dev/conda-forge",
863-
]
852+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:build-system"
864853
```
865854

866855
!!! note
867856
We are currently not publishing the backends on conda-forge, but will do so in the future.
868-
For now the backends are published at "https://prefix.dev/pixi-build-backends".
857+
For now the backends are published at [conda channel](https://prefix.dev/channels/pixi-build-backends).

docs/source_files/pixi_tomls/simple_pixi_build.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,9 @@ hatchling = "*"
3939
simple_python = { path = "." }
4040
# --8<-- [end:dependencies]
4141

42+
# --8<-- [start:run-dependencies]
43+
[run-dependencies]
44+
rich = ">=13.9.4,<14"
45+
# --8<-- [end:run-dependencies]
46+
4247
# --8<-- [end:full]

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ nav:
126126
- Pytorch Installation: features/pytorch.md
127127
- Building Packages:
128128
- Getting started: build/getting_started.md
129-
- Dependency Types: build/dependency_types.md
130129
- Tutorials:
131130
- Building a Python package: build/python.md
132131
- Building a C++ Package: build/cpp.md
133132
- Multiple Packages in Workspace: build/workspace.md
133+
- Dependency Types: build/dependency_types.md
134+
- Build Backends: build/backends.md
134135
- Advanced:
135136
- Authentication: advanced/authentication.md
136137
- Channel Logic: advanced/channel_priority.md

0 commit comments

Comments
 (0)