Hacker News new | past | comments | ask | show | jobs | submit login

There are some different/new tools for creating your own Python packages these days. It's still not truly solved in the sense of having a single clear winner , but one of these new package generation tools might serve you better:

poetry2nix: https://github.com/nix-community/poetry2nix

mach-nix: https://github.com/DavHau/mach-nix

dream2nix: https://nix-community.github.io/dream2nix/guides/getting-sta...

pynixify: https://github.com/cript0nauta/pynixify

pip2nix: https://github.com/nix-community/pip2nix

The tools available to you at the time (pypi2nix and maybe python2nix, if it was a long time ago) have been abandoned in favor of the newer tools, I think chiefly poetry2nix but I'm not sure.

There's still the Nixpkgs buildPythonPackage stuff, I think, if your goal is to upstream a lib into Nixpkgs. But if you just want to build your own Python applications and vendorize the deps (e.g., for work), you might try one of the tools above, which weren't available 3+ years ago.

dream2nix is by the author of mach-nix IIRC and has the goal of establishing a unified standard and codebase for ${proglang}2nix type package generators. But mach-nix is still maintained and might be the more feature-complete choice between them.

Maybe Nix-y Python users and developers can reply with some of their experiences using those tools for real projects :)




I have used plain nixpkgs, poetry2nix and mach-nix for packaging "real" projects. My biggest take away is that python packaging is a hot mess. This isn't exactly news that no one has heard before though.

The initial work for packaging a complicated python app is dominated by sorting through a lot of confusing errors, no matter what tool you use. poetry2nix and plain nix has been my best experience so far in python packaging though.

For my simple python packages, I'm using plain nix and flit, which has been the simplest. It's not feasible for python applications that need complicated dependency version resolving due to python dependency pinning though.

Here's the plain nix + flit example that I really like: https://git.sr.ht/~averagechris/deduper/tree/main/item/flake...

The poetry2nix projects I have worked with are closed source sadly so I can't link them.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: