Strategies for packaging Python apps on a Linux platform

Suppose you have written an app in Python and want to distribute it to other users of the Linux platform.  There are several strategies or flavors for packaging your app.  The strategies vary by the sophistication of the intended user.  This is about packaging (creating an object to be distributed) not about marketing (placing the object where users can download it.)  The object may be called a distribution, or an app bundle,  or a packaging.

The strategies, in order:

  1. A Debian packaging that wraps a Pyinstaller binary
  2. A Debian packaging created from a disutils packaging
  3. A disutils packaging
  4. A simple archive or repository of your app source code.

A Debian packaging that wraps a Pyinstaller binary

This is easiest for a user.  The user is typically a non-programmer, and doesn’t use a command line.  The packaging is one .deb file.  The user can click on it.  That launches a package manager app, say the Ubuntu Software Center.  After installation, your app appears as an icon at least in the platform’s list of installed applications, for example in the Ubuntu Dash.  The user can uninstall cleanly and easily.

The crux of this strategy is: you distribute a self-contained binary and a few other incidentals (icon and .desktop files.)  This strategy subverts the usual Linux distribution strategy, which is all about dependencies.  Here, Pyinstaller alleviates the packager from worrying about dependencies (although you still might struggle with dependencies when using Pyinstaller.)  One downside is that the distribution may be large (since it includes all dependencies.)

(I hope to blog details later.)

A Debian packaging created from a disutils packaging

This is just as easy for the user, but harder for you the programmer, since you must understand much about Debian packaging.

These links will get you started (or scare you off):

Debian Wiki: Python Packaging

Debian Python Apps Team

The crux of this strategy is: it still follows the usual Linux distribution strategy of only packaging your app along with a dependency map (which is used at install time.)  One upside is that the distribution may be smaller.

This strategy should also let the user easily install an app that is desktop friendly (clickable icons in the usual places.)

A disutils packaging

This is usually for users who are Python programmers.  The user knows how to manage and launch their Python apps from a command line.  The user finds your apps in places like the Python Package Index (PyPI).

This strategy is the basis for the strategy above.

This strategy does not alleviate the user from worrying about dependencies (within the Python installation of the user.)  Adventures in Python Packaging is a recent blog about the experience of packaging.  An example problem is: the user runs your app and it declares a Python module cannot be imported.  Then the user must find, download, and install missing modules.

A simple archive of your app source code

This is for users who are Python programmers who will probably hack your code and integrate it with their program.  They might get the archive via email or simple ftp, or clone your repository from Github or SourceForge.  They are willing to  fix any dependency problems.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s