Precompiling and deploying Python
to any Linux, FreeBSD or Mac OS X system
Péter Szabó, pts@google.com

EuroPython, Florence, 2011-06-23

Misery of manual installation

Developer to the user: This server is a small Python script, and it depends on Concurrence only.

How to precompile Python programs?

Create single-file executable or installer:

Bundle all C code into a single-file executable:

Cross-platform

What's included

The stackless binary contains:

More goodies in the stacklessco binary

stacklessco also runs these at full speed:

How many bytes is the 2.7 binary?

Linux
binaryuncompressedcompressedsavings
python61460183440514–44%
stackless63102693469037–45%
stacklessco78084914148341–47%
Mac OS X
binaryuncompressedcompressedsavings
python58473463321314–43%
stackless60207173353053–44%
stacklessco75418114039337–46%

How is the binary constructed?

Distribution-specific changes

Distribution-specific changes for modules

The build system (build.sh)

Porting issues

Mac OS X:

FreeBSD:

?