Is there a way to "link" a python program from several files?

Diez B. Roggisch deets at nospam.web.de
Sat Feb 16 18:11:42 EST 2008


Brian Smith schrieb:
> Diez B. Roggisch wrote:
>> Edward A. Falk schrieb:
>>> IOW, is there a "linker" for python?  I've written a 
>>> program comprised of about five .py files. I'd like to
>>> find a way to combine them into a single executable.
>>> Obviously, I could hand-edit them into a single 
>>> .py file, but I'm looking for a way to keep them as 
>>> seperate files for development but distribute the
>>> result as a single file.
> 
>> Depending on the OS, there are several options. Ranging from 
>> distributing an .egg (setuptools) over py2exe for windows to 
>> py2app on OSX - and some more, e.g. cx_freeze.
> 
> I would be interested in a program that can combine multiple modules
> into a single module, which removes all the inter-package imports and
> fixes other inter-module references, like Haskell All-in-One does for
> Haskell: http://www.cs.utah.edu/~hal/HAllInOne/index.html

won't happen for python. python relies heavily on modules/packages being 
namespaces.

Why would you want such a beast anyway? If it's about 
single-file-distribution, that is solved by some of the above mentioned 
tools - or even not desired anyway (say OS X bundles)

Diez



More information about the Python-list mailing list