# Packaging a Python program. Missing dependencies and name collisions

**URL:** https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069
**Category:** Help
**Created:** [April 9, 2024, 5:31pm UTC](https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069 "2024-04-09T17:31:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dflores1](https://discourse.nixos.org/user_avatar/discourse.nixos.org/dflores1/32/16933_2.png) [@dflores1](https://discourse.nixos.org/u/dflores1)
#### Post date: [April 9, 2024, 5:31pm UTC](https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069/1 "2024-04-09T17:31:47Z")

</div>

Hi there,

I have a couple of questions about how to create a package for a python program ([MultiQC](https://multiqc.info)). 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](https://github.com/jsvine/spectra/tree/master). 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!

---

<div class="post-metadata">

### Author: ![illustris](https://discourse.nixos.org/user_avatar/discourse.nixos.org/illustris/32/3334_2.png) [@illustris](https://discourse.nixos.org/u/illustris)
#### Post date: [April 9, 2024, 5:59pm UTC](https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069/2 "2024-04-09T17:59:27Z")

</div>

> [@dflores1](#):
>
> 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?

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

> [@dflores1](#):
>
> given that it’s gonna be a python3 library maybe I don’t need to rename it?

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`.

> [@dflores1](#):
>
> How do you actually test that it builds?

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

---

<div class="post-metadata">

### Author: ![jonringer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jonringer/32/1348_2.png) [@jonringer](https://discourse.nixos.org/u/jonringer)
#### Post date: [April 9, 2024, 6:59pm UTC](https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069/3 "2024-04-09T18:59:57Z")

</div>

> [@illustris](#):
>
> I would do the latter. Include all the new packages in one PR with different commits for each package.

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.

---

<div class="post-metadata">

### Author: ![dflores1](https://discourse.nixos.org/user_avatar/discourse.nixos.org/dflores1/32/16933_2.png) [@dflores1](https://discourse.nixos.org/u/dflores1)
#### Post date: [April 10, 2024, 10:40am UTC](https://discourse.nixos.org/t/packaging-a-python-program-missing-dependencies-and-name-collisions/43069/4 "2024-04-10T10:40:09Z")

</div>

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.
