I have been working with Python a lot more recently, and it feels like I spend more time fighting packaging than writing code.
Python’s primary package manager, pip, is roughly equivalent to the best 1990s had to offer(Perl CPAN), it makes it depressingly easy to end up with a broken environment.
Pixi: A modern packaging system for Python
pixi is a modern package manager along the lines of deno/pnpm, but for Python. It’s a single binary that you can download and run. It will install Python + native packages within a single subdirectory. It will use pixi.toml
file to track dependencies + pixi.lock
to track exact versions of transitive dependencies.
See the official pixi annoucement for more details.
Interesting features
- It really doesn’t like installing stuff into the global namespace. It seems hard to destroy your system with it.
- Unexpectedly, I found it convenient to install Python, rust, node and pnpm within Docker
- deno_task_shell seems promising
- Tasks provide a nice way to manage old-school Makefile-style dependencies.
- it’s fast! It can reinstall my project in less than a second from local cache.
What I don’t like
- It does not yet handle pip packages. prefix.dev team is working on this. So I gotta fallback to
pip freeze
dance for packages that are not in conda. - Occasionally, it may corrupt some state. Using
rm -fR .pixi;pixi install
will reload the environment from the pixi.toml file and the package cache.
Conclusion
If you’re struggling with Python packaging, give pixi a try. It’s a breath of fresh air. The tool is only 9 days old, but it’s already very usable and helps me reduce frustration with Python packaging. The team behind it appears to be extremely effective, responsive, and open to feedback. I’m looking forward to seeing where they take it.