pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Allow to specify build-backend for source code without `pixi.toml`

Open Hofer-Julian opened this issue 1 year ago • 5 comments

At the moment we have code in order to deal with source packages built by:

  • conda-build
  • rattler-build
  • pixi-build

While conda-build isn't implemented, rattler-build works by spinning up the pixi-build-rattler-build backend behind the scenes. It does that by hard-coding the "conda-forge" and "https://prefix.dev/pixi-build-backends" channels, which isn't flexible nor robust.

https://github.com/prefix-dev/pixi/blob/0a04b0ca7b6c86f64848b4e31f7b57edb44eb6e5/crates/pixi_build_frontend/src/protocols/builders/rattler_build.rs#L116-L130

The motivation for direct conda-build and rattler-build support is in order to depend on 3rd party packages built on a forge like conda-forge.

I believe that it would be both simpler and powerful to add an optional src field to package.

[package.build]
backend = { name = "pixi-build-rattler-build", version = "0.1.*" }
channels = [
  "https://prefix.dev/pixi-build-backends",
  "https://prefix.dev/conda-forge",
]
src = { git = "https://github.com/conda-forge/numpy-feedstock" }

src would default to { path = "."}, and therefore have the same behavior as is.

Hofer-Julian avatar Mar 13 '25 08:03 Hofer-Julian

I like the idea! I was also thinking about that lately. But since I was more on the using end I didn't want to create extra pixi.tomls or "packages" for the dependencies.

So I was thinking about making it part of the dependency spec:

[dependencies]
ros-jazzy-navigation2-msgs = { git = "https://github.com/navigation2/navigation2", build-backend = "pixi-build-ros-package"}

Do you think that would make sense to solve the same problem?

ruben-arts avatar Mar 13 '25 08:03 ruben-arts

Mmm yeah that seems more powerful indeed!

But you would need to create a pixi.toml for the feedstocks you want to depend on.

E.g. you root pixi.toml would look like:

[dependencies]
numpy = { path = "numpy-feedstock" }

and you would need a pixi.toml in the numpy-feedstock directory with the above contents.

Vs, how it is now:

[dependencies]
numpy = "https://github.com/conda-forge/numpy-feedstock"

baszalmstra avatar Mar 13 '25 08:03 baszalmstra

I like the idea! I was also thinking about that lately. But since I was more on the using end I didn't want to create extra pixi.tomls or "packages" for the dependencies.

So I was thinking about making it part of the dependency spec:

[dependencies] ros-jazzy-navigation2-msgs = { git = "https://github.com/navigation2/navigation2", build-backend = "pixi-build-ros-package"} Do you think that would make sense to solve the same problem?

could we make it as a table? for example

[dependencies.ros-jazzy-navigation2-msgs]
git = "https://github.com/navigation2/navigation2"
build-backend = "pixi-build-ros-package 0.1.0"
channels = "...." # ( optional, will inherit pixi.toml channels by default ) 

nichtmacho avatar Mar 13 '25 09:03 nichtmacho

Yeah, my suggestion is clearly more verbose. Your summary was indeed what I had in mind @baszalmstra.

I think @ruben-arts' and @nichmor's alternative might be a good, less verbose alternative. I'd be fine with going for that one instead.

Here a slightly fixed up version:

[dependencies.ros-jazzy-navigation2-msgs]
git = "https://github.com/navigation2/navigation2"
build-backend = "pixi-build-ros-package 0.1.0"
channels = "...." # ( optional, will inherit pixi.toml channels by default ) 

Hofer-Julian avatar Mar 13 '25 09:03 Hofer-Julian

Just for reference: feedstocks have a variant configuration that also includes the channels that should be used (I think). E.g. in this one: https://github.com/conda-forge/xtensor-feedstock/blob/main/.ci_support/linux_64_.yaml you can see channel_sources which should probably be the default for where to pull packages from.

I think for feedstock, in any case, we could probably hard code some defaults as well.

wolfv avatar Mar 13 '25 10:03 wolfv