Packaging and deployment of standalone Python applications?

dieter dieter at handshake.de
Tue Sep 15 01:46:06 EDT 2015


Kristian Rink <kawazu428 at gmail.com> writes:

> Folks;
>
> coming from a server-sided Java background, I'm recently exploring frameworks such as cherrypy or webpy for building RESTful services, which is quite a breeze and a pretty pleasant experience; however one thing so far bugs me: Using Java tooling and libraries such as DropWizard, it is pretty straightforward to build an "all-inclusive" application containing (a) all code of my own, (b) all required dependencies, (c) all other resources and, if required, even (d) a Java virtual machine in one large .zip file which can easily be copied to a clean Linux VM, unzipped and started there.
>
> Are there ways of doing so using Python, too?

I do not think that the Python support in this regard is as
sophisticated as in the Java world.

Have a look at "distribute/setuptools". It supports (a) and (b)
(event though you must write a "setup.py" without the help of an UI)
and allows to state the dependencies (part of (c)). It can generate
a so called "egg" (a distribution unit) representing one distributable
component.

On installation, you still need a local Python (with its runtime
environment) and the installation process will try
to resolve the stated dependencies - potentially requiring internet access.


In order to get one executable containing the Python interpreter
and all required packages, there is "freeze" (and when I remember
right a solution provided by "eGenix"). However, you must manually prepare
the application such that "freeze" learns about the "required packages".
"freeze" is likely too old that it already would interprete the dependency
declarations.

You might also have a look at "zc.buildout". Its primary task is
to ensure the setup of a consistent development/deployment environment
across different environments (hosts). It relies on a local Python
installation - but can handle almost everything else.
Again - without UI support.




More information about the Python-list mailing list