[Distutils] including a third party egg without "installing" it

Randall Smith randall at tnr.cc
Thu May 14 05:56:50 CEST 2009


I'd like to bundle some third party eggs with my application without 
installing them.  Typically, I'd read __file__ and alter sys.path at 
runtime to include the third party packages, but I understand that will 
not work with zipped eggs.

I don't know the best way to go about this, but I at least want to know 
a clean way to do it without requiring the third party eggs to be 
downloaded and installed separately.  Consider this layout.

theapp/
   docs/
   setup.py
   theapp/
     __init__.py
     app.py
     ext/
       thirdparty1.egg
       thirdparty2.egg
       thirdparty3.egg
   tests/

 From my current understanding about how setuptools works, I think I 
could treat the third party eggs as data files and and runtime 
(somehow?) insert them into the path and import them.

I'm trying to work from this example.

http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources

Is this a workable approach?  Is there a better way?

--Randall



More information about the Distutils-SIG mailing list