Previously, I had tried modifying and adding recipes to conda channels. This time, I want to package my DevSSH and upload it to my own channel. I decided to try building a conda package myself.
Why choose pixi and rattler-build?
This was actually a coincidence… I originally wanted to register an Anaconda account to use conda-build, but their website was acting up and I couldn’t complete the registration. So I switched directly to prefix.dev, which gave me a chance to learn about newer tools.
Introduction to rattler-build
rattler-build is a next-generation conda package builder developed by the team behind pixi. Written in Rust, it naturally offers faster build speeds. It is somewhat compatible with conda-forge’s build system and has a certain level of integration with pixi.
Configuring pixi.toml
pixi‘s core functionality is to set up development environments, but it can also be used to configure build environments for software packages. To do this, you need to use the package keyword and enable the experimental pixi-build feature within the [workspace] section.
1 | [workspace] |
Writing a rattler-build recipe
rattler-build uses YAML‑format recipe files to define how a package is built. It is compatible with recipes from conda-build, though it does not support all conda-build recipe syntax.
Here is the recipe I wrote for DevSSH:
1 | package: |
Building and uploading the package
1. Local build
If the configuration files are set up correctly, running the build command should produce a conda‑format package.
1 | # Build with pixi |
If you encounter issues, you can ask AI step by step. However, note that rattler-build is not yet mainstream, so answers you get may often be based on conda-build. You’ll need to cross‑check with the documentation and experiment.
2. Setting up a prefix.dev account and uploading
Before uploading, you need to log in, create a channel under your account, and set up an API_TOKEN.
1 | # Set the API token |
Once configured, you can directly upload the built package. With a good internet connection, it completes quickly.
1 | pixi upload prefix devssh-0.1.1-hb0f4dca_0.conda -c sylens |
3. Installing the package via the channel
You can install it with either pixi or conda.
1 | pixi global install -c https://prefix.dev/sylens devssh |