Skip to main content
Learn how to build Python packages with Pixi, leveraging the conda ecosystem’s cross-language capabilities.
pixi-build is a preview feature and will change until stabilized. Keep this in mind for production projects.

Why Build Python Packages with Pixi?

Building Python packages with Pixi offers unique advantages:
  1. Cross-language support - Manage Python packages alongside Rust, C++, R, and other languages
  2. Unified tooling - Build both conda and Python packages with the same tool
  3. Conda ecosystem - Access packages from conda-forge, not just PyPI
  4. Workspace support - Develop multiple interdependent packages together

Creating Your First Python Package

You should see:

Advanced Configuration

Using Custom Backend Channels

For the latest backend features:

Noarch Packages

For pure Python packages without compiled extensions:
This creates a single package that works across all platforms.

Custom Build Configuration

Real-World Example

Here’s a complete example from the array-api-extra package:
pixi.toml

Understanding Host vs Run Dependencies

Python packages need to declare dependencies in two places:In pyproject.toml (for PyPI):
In pixi.toml (for conda):
This allows the same package to work in both ecosystems.
Host dependencies are needed during the build process. For Python:
These come from conda channels, ensuring consistent build environments.See dependency types for details.

Integration with pyproject.toml

You can integrate Pixi configuration into pyproject.toml:
pyproject.toml

Next Steps

Workspaces

Combine multiple packages in one workspace

Dependency Types

Understand build, host, and run dependencies

C++ Integration

Mix Python with C++ packages

Build Variants

Build against multiple Python versions

Common Issues

Technical Limitation: Dependencies like hatchling, pip, and uv must be in host-dependencies (not build-dependencies) due to how the build process currently works. This ensures the correct Python prefix is used.
Ensure your package is added to workspace dependencies:
Add missing dependencies to run-dependencies: