Skip to content

Commit d1f5aee

Browse files
feat: mention git deps in pixi build docs (#3126)
Co-authored-by: Julian Hofer <[email protected]>
1 parent 86701ad commit d1f5aee

File tree

2 files changed

+40
-15
lines changed

2 files changed

+40
-15
lines changed

docs/build/getting_started.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,67 @@ The vision is to enable building of packages from source, for any language, on a
2222

2323
## Setting up the Manifest
2424

25+
This is an overview of the pixi manifest using `pixi-build`.
2526

26-
```toml
27+
```toml title="pixi.toml"
2728
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:full"
2829
```
2930

31+
32+
Under the `[workspace]` section, you can specify properties like the name, channels, and platforms. This is currently an alias for `project`.
33+
3034
Since the build feature is still in preview, you have to add "pixi-build" to `workspace.preview`.
3135

36+
3237
```toml
3338
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:preview"
3439
```
3540

41+
3642
In `package` you specify properties specific to the package you want to build.
3743

3844
```toml
3945
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:package"
4046
```
4147

48+
4249
Packages are built by using build backends.
4350
By specifying `package.build-system.build-backend` and `package.build-system.channels` you determine which backend is used and from which channel it will be downloaded.
44-
In this example, we are using `pixi-build-python` in order to build a Python package.
51+
There are different build backends. Pixi backends can describe how to build a conda package, for a certain language or build tool.
52+
In this example, we are using `pixi-build-python` backend in order to build a Python package.
4553

4654
```toml
4755
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:build-system"
4856
```
4957

50-
1. Specifies workspace properties like the name, channels, and platforms. This is currently an alias for `project`.
51-
2. Since the build feature is still in preview, you have to add "pixi-build" to `workspace.preview`.
52-
3. We need to add our package as dependency to the workspace.
53-
4. In `package` you specify properties specific to the package you want to build.
54-
5. Packages are built by using build backends.
55-
By specifying `build-system.build-backend` and `build-system.channels` you determine which backend is used and from which channel it will be downloaded.
56-
6. There are different build backends.
57-
Pixi backends can describe how to build a conda package, for a certain language or build tool.
58-
For example, `pixi-build-python`, allows building a Python package into a conda package.
59-
7. `simple_python` uses `hatchling` as Python build backend so this needs to be mentioned in `host-dependencies`.
60-
Read up on host-dependencies in the [Dependency Types](./dependency_types.md#host-dependencies)
61-
8. Python PEP517 backends like `hatchling` know how to build a Python package.
62-
So `hatchling` creates a Python package, and `pixi-build-python` turns the Python package into a conda package.
58+
59+
We need to add our package `simple_python` as dependency to the workspace.
60+
61+
`pixi` also supports `git` dependencies, allowing you to specify a `branch`, `tag`, or `rev` to pin the dependency.
62+
If none are specified, the latest commit on the default branch is used. The `subdirectory` is optional and specifies the location of the package within the repository.
63+
64+
65+
```toml
66+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:dependencies"
67+
```
68+
69+
`simple_python` uses `hatchling` as Python build backend, so this needs to be mentioned in `host-dependencies`.
70+
71+
Python PEP517 backends like `hatchling` know how to build a Python package.
72+
So `hatchling` creates a Python package, and `pixi-build-python` turns the Python package into a conda package.
73+
74+
Read up on host-dependencies in the [dependency types chapter](./dependency_types.md#host-dependencies)
75+
76+
```toml
77+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:host-dependencies"
78+
```
79+
80+
We add `rich` as a run dependency to the package. This is necessary because the package uses `rich` during runtime.
81+
You can read up on run-dependencies in the [dependency types chapter](./dependency_types.md#dependencies-run-dependencies)
82+
83+
```toml
84+
--8<-- "docs/source_files/pixi_tomls/simple_pixi_build.toml:run-dependencies"
85+
```
6386

6487
## CLI Commands
6588
Using the preview feature you can now build packages from source.

docs/source_files/pixi_tomls/simple_pixi_build.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ hatchling = "*"
3737
# We add our package as dependency to the workspace
3838
[dependencies]
3939
simple_python = { path = "." }
40+
# pixi also support git dependencies
41+
boost-check = { git = "https://github.com/wolfv/pixi-build-examples", branch = "main", subdirectory = "boost-check" }
4042
# --8<-- [end:dependencies]
4143

4244
# --8<-- [start:run-dependencies]

0 commit comments

Comments
 (0)