For a while I've been trying to find the best way to package a python app as a debian file that I can distribute for installing on Ubuntu.
I also didn't necessarily want to rely on the python packages that are distributed with the system because with python you tend to get used to having the latest packages installed through pip.
Then I found dh-virtualenv
which is a very neat way of packaging python into debs with the key advantage that these apps are packaged as a virtualenv so that the latest packages can be included without relying on the packages on the system... But system packages can also be used.
In this post I've created an that example illustrates how to package a python script as a .deb using dh-virtualenv. The example can be found on github.
This includes all the files necessary to package the example as a deb, where the app we are building into a python package is contained in a single file: