Packaging Python modules that are also applications

What’s the convention for packaging a Python application that also provides a library?

For instance, I’m starting to package some of the OpenStack CLI tools, and the main CLI (python-openstackclient) relies on python-novaclient. However, python-novaclient also provides the older CLI for nova itself. Most other OpenStack components (glance, cinder, neutron, etc) do something similar.

So I used buildPythonApplication for both, rather than buildPythonPackage. Is this right? And if it’s the case, should I take python-novaclient out of the python-modules directory? Or should I keep it in python-modules and point to it from elsewhere?

Any opinions?

1 Like

After skimming through nixpkgs for a little while I realized I could use python3Packages.toPythonApplication.

going to paste my template that i use for reviews:

According to the readme, this is meant to also be used as an application. Do you mind adding the following to pkgs/top-level/all-packages.nix:

  <pkg-name> = with python3Packages; toPythonApplication <python-module>;

More information on this can be found here

1 Like

I also have a video going over python packaging in nixpkgs. Not all of this may be useful, but a lot of it should:

1 Like

Hey, thanks!

I skimmed through the nixpkgs manual but missed that part the first time. I’ll check out the video as well.