Why Build Python Packages with Pixi?
Building Python packages with Pixi offers unique advantages:- Cross-language support - Manage Python packages alongside Rust, C++, R, and other languages
- Unified tooling - Build both conda and Python packages with the same tool
- Conda ecosystem - Access packages from conda-forge, not just PyPI
- 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:Custom Build Configuration
Real-World Example
Here’s a complete example from thearray-api-extra package:
pixi.toml
Understanding Host vs Run Dependencies
Why specify dependencies twice?
Why specify dependencies twice?
Python packages need to declare dependencies in two places:In In This allows the same package to work in both ecosystems.
pyproject.toml (for PyPI):pixi.toml (for conda):What are host-dependencies?
What are host-dependencies?
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 intopyproject.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
Package not found after build
Package not found after build
Ensure your package is added to workspace dependencies:
Import errors at runtime
Import errors at runtime
Add missing dependencies to
run-dependencies: