Looking for an up-to-date step-by-step guide to create a deb from a Python package

When trying to find some information about how to create a deb from a Python package, a lot of terms show up:

  • pybuild
  • debhelper
  • dh-python
  • stdeb

I do have experience with Python packaging, but not with deb packaging.

There seems to be a lot of history in deb packaging, especially for Python packages.

It is not entirely clear which of the many ways is the current recommended one. Following the Debian wiki pages from Python/LibraryStyleGuide - Debian Wiki it looks like - as of 2013 - pybuild would be the recommend way.

The wiki for Pybuild is definitely not targeted at a packaging beginner, more like at an experienced packager who packages Python for the first time.

So, my two questions are:

  • What is the currently recommended way to package a simple, setuptools based, pure Python 3 package?
  • Is there any beginner friendly step-by-step guide out there?

Thanks!

This is all really a matter for Debian, not Python.

That wiki page looks very out of date. AFAIK, this is their current Python packaging policy, and this page lists the current tools. Do note that it still contains a fair amount of information that is not necessarily still up to date with regard to the Python packaging side of the equation, discussing the long-deprecated and to-be-removed distutils in detail, containing a chunk of FUD about wheels, and not mentioning anything I can find about the modern packaging landscape with PEP 517, 518 and 621, or the non-setuptools build backends that many packages use nowadays, for example, not to mention tools like build, installer, etc.

I can’t seem to find anything like a beginner-focused tutorial, at least an official, up to date one, but I am by no means a Debian expert. There are some third party ones on Google, but I cant vouch for their quality and a lot of packaging information you might find in the wild is out of date or just plain wrong.

If you run into trouble, Debian people like @doko42 or @barry might be able to help further.

Best of luck!

1 Like

Not me. I really haven’t done any Debian work in several years.

Oh, I thought you mentioned something about that at PyCon and I saw your name on the list of authors of the Debian packaging policy. @doko42 is definitely still active, though.

1 Like

@jugmac00 I’d ask on Debian Mailing Lists -- Index for debian-python. What I’ve done previously is use debmake to generate the files, and then use git-buildpackage with cowbuilder to handle versioning/changelog/building.

@CAM-Gerlach Debian Python Policy 0.12.0.0 documentation is about distributing wheel as zips inside deb packages (not temporary wheels produced internally by the build system). pybuild handles the PEP 517 stuff (probably using build internally), but I suspect the references to distutils are because there is a long legacy of packages which haven’t switched to PEP 517.