[C++-sig] Subset of default python library

Nat Goodspeed nat at lindenlab.com
Thu Sep 10 16:05:55 CEST 2009


Mark Chandler wrote:

> Is there a small subset of the default python library that i can use for 
> our embedded instance. Since this is part of a larger app that doesnt 
> expect to have python installed thus we are including it with the 
> program data. How ever there is alot of stuff in there that we are not 
> going to use (all the server stuff) and dont want clients using as 
> well.

Have you looked at the distutils tools? I know there's functionality to 
start from a "root set" of referenced Python library modules and produce 
an exhaustive list of recursively-referenced modules.

I haven't directly used those tools myself because my experience is more 
with py2exe and py2app:
http://www.py2exe.org/
http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html

In our case, instead of embedding the Python interpreter into our C++ 
application, we started with a Python main program and wrapped our C++ 
code as extension modules. This structure works well with py2exe and py2app.

Both tools package the minimum subset of the Python standard library 
needed for your specific application, and that functionality is 
available via distutils.


More information about the Cplusplus-sig mailing list