pyproject.toml files, allowing Python projects to use a single manifest file for both Python packaging and pixi environment management.
Overview
When usingpyproject.toml, all pixi configuration goes under the [tool.pixi] section. This allows seamless integration with Python build tools like setuptools, poetry, or hatchling.
Basic Structure
Configuration Sections
All sections frompixi.toml are available under [tool.pixi]:
Workspace Configuration
Dependencies
Tasks
Environments
Features
Complete Example
Here’s a completepyproject.toml with both Python packaging and pixi configuration:
Editable Installation Pattern
A common pattern is to install the package itself in editable mode:Migration from pixi.toml
To migrate frompixi.toml to pyproject.toml:
-
Copy sections under
[tool.pixi]: -
Rename
[project]to[tool.pixi.project]: -
Add Python build config if needed:
-
Test the migration:
Advantages
Single manifest file
Single manifest file
No need to maintain both
pixi.toml and pyproject.toml. Everything in one place.Standard Python tooling
Standard Python tooling
Works with standard Python build tools (pip, build, twine, poetry, hatch).
Editable installs
Editable installs
Easy to set up editable installs for development:
PyPI publishing
PyPI publishing
Can build and publish to PyPI while using pixi for development:
Limitations
Which Should I Use?
Use pyproject.toml when
Use pyproject.toml when
- You’re building a Python package for PyPI
- You want a single manifest file
- Your project is primarily Python
- You’re using Python build tools (setuptools, poetry, hatch)
Use pixi.toml when
Use pixi.toml when
- You’re building conda packages
- Your project uses multiple languages
- You need the
[package]section - You want better editor support for pixi-specific features
- Your project is not primarily Python
Use both when
Use both when
You can have both files! Pixi will use
pixi.toml if present, otherwise falls back to pyproject.toml.Useful for:- Publishing to both conda and PyPI
- Separating concerns (packaging vs environment management)
Examples from Real Projects
Data Science Library
CLI Tool
Related
- pixi.toml Reference - Full pixi.toml documentation
- Python Integration - Python-specific pixi features