[Distutils] distributing a large python application

Stefan Seefeld seefeld at sympatico.ca
Thu Sep 18 15:29:31 EDT 2003

Jesse Hammons wrote:
> I am looking for advice on how to trip down the size of a monothic
> application I am building with python/wxPython.
> This project involves the python code from python, wxPython significant
> amounts of C and C++ code from wxPython, PyOpenGL and the underlying
> application functionality, which is largely a set of unix commands
> implemented in C.
> My question is: what strategies are there for doing a more traditional
> linking stage for the final application bundle?  As it stands, I
> packaged up python, wxPython and PyOpenGL with my app and it came to a
> 100Meg binary.  I use only a small portion of the funcionality of those
> packages (e.g. site-packages from python) but the wxPython and OpenGL
> extensions are done as shared libraries which means the whole thing
> goes out.
> I have tried freeze.py and similar, but that just seems to make things
> bigger.

hmm, sounds as if the size is more determined by the shared lirbaries
you depend on (wxWindows, GL, etc.) rather than the python wrappers.

> Are there tools that do a static analysis of python code to list which
> packages are actually used?  What about a dynamic analysis (I run my
> app, then dump the list of loaded modules and just ship those).
> For the C/C++ code, I am thinking of just statically linking the
> extensions into a python exectable and letting the linker strip dead
> code.

yeah. But that doesn't help you strip down the C++ libraries. For those
you have to repackage the original libs (or at least use static libs 
whenever you can).


More information about the Distutils-SIG mailing list