Packaging a Python program. Missing dependencies and name collisions

Hi there,

I have a couple of questions about how to create a package for a python program (MultiQC). This python program depends on some python libraries that are not available in nixpkgs yet, so I need to include them.

The first question is, how do I go about it? Do I create a new branch with a package for each one of the missing libraries and wait for the merge, or I just do everything in one branch?

The second question is about name collisions in python. One of the new libraries is called spectra. There are other packages with that name, a C++ library and a R library. For now, I named it spectra-py, but given that it’s gonna be a python3 library maybe I don’t need to rename it? How do you actually test that it builds? The way I do it now is:

nix-build -A spectra-py

Thanks a lot!

I would do the latter. Include all the new packages in one PR with different commits for each package.

That’s correct. Instead of adding your package to pkgs/top-level/all-packages.nix or pkgs/by-name/, add it to pkgs/top-level/python-packages.nix. This way you can build it as python3Packages.spectra.

Without flakes: nix-build -A python3Packages.spectra
With flakes: nix build .#python3Packages.spectra

2 Likes

If it’s your first time contributing, sometimes short PRs to get “initial feedback” is nice, so that you can then apply some of the feedback across all of them.

If it’s 3 or more packages, sometimes PRs just become “feedback loop” monsters.

Actually, it is going to be the second. My first package didn’t have any dependencies, and yes, I had some feedback but that was ok.