Distributing Python apps

Richie Hindle richie at entrian.com
Mon Jan 6 08:46:57 EST 2003


[David LeBlanc]
> Taking a quick glance at just Python, I don't think your goal of putting
> Python + app + data on a single 1.44mb floppy is realistic.

But the OP doesn't need to do that - he only needs to ship the pieces
his application needs, which py2exe will extract and InnoSetup will
compress.

> In terms of a download, I'm betting that 2+mb for a runtime only including
> application bytes (binaries and doc) is more likely.

A small but non-trivial Python program, 'compiled' with py2exe and
packaged with InnoSetup, should total less than a megabyte.  Adding a
GUI toolkit will probably take that beyond the 1.44MB mark, but Norm
said "I don't want to deliver on a CD or a floppy.  I want to deliver by
ftp."

For example, a small CGI script called 'xxx.py', which relies on a few
Python standard library modules including 're' and 'socket', compiles
using py2exe to this:

 292643 Dec 11 09:43 xxx.exe
 847920 Oct 14 18:02 python22.dll
  45103 Oct 14 18:02 _socket.pyd
  53292 Oct 14 18:03 _sre.pyd
  36864 Oct 14 18:03 _winreg.pyd

That totals 1,275,822 bytes uncompressed.  The resulting InnoSetup
installer, built with all the default options, is 965,948 bytes.  This
is with Python 2.2.2.

In terms of how much work this is, you need py2exe and InnoSetup, plus
this script for py2exe, which you run with "python setup.py py2exe":

--------------------------- setup.py ---------------------------

from distutils.core import setup
import py2exe
setup(name="xxx.py", scripts=["xxx.py"])

----------------------------------------------------------------

plus an InnoSetup script that takes about a minute to generate using the
InnoSetup wizard (which you can easily use out of the box without
reading the manual, unless you need to do anything out of the ordinary).

[Norm]
> how can I deliver my application to my customers with the least cost?

Hopefully I've answered that question.  Python, py2exe and InnoSetup are
all free (as in both beer and speech).

-- 
Richie Hindle
richie at entrian.com





More information about the Python-list mailing list