Easy install / setuptools

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Jun 3 04:37:54 CEST 2008

En Thu, 29 May 2008 06:29:00 -0300, <Dominique.Holzwarth at ch.delarue.com>  

> I'm trying to figure out the "best" way to distribute my own python  
> packages. Basicly, what I want is to have something like an  
> "installer.exe" (on windows) which puts my package under  
> Python/Lib/site-packages (so that it can be found via the PYTHONPATH).
> I've played around a bit with "easy install" and "setuptools" and the  
> .egg format. I've already managed to create a "myPackage.egg" file with  
> setup tools and "install" (it's just a copying) it ito the site-packages  
> directory using "easy install".

You don't need setuptools at all. Just write a setup.py file using the  
standard distutils module, and execute:

python setup.py bdist_wininst

It will create an executable installer. A simple setup.py script looks  
like this:

---begin setup.py---
 from distutils.core import setup

setup(name='My Package',
       description='This is the description of myPackage',
---end setup.py---

Read the "Distributing Python Modules" document in your Python  
installation, or at <http://docs.python.org/dist/dist.html>

> What I was wondering now is if there's a way to actually EXTRACT the egg  
> file and put the extracted file (i.e. the .py file) under site-packages.  
> And not the .egg?

Well... don't use an egg in the first place :)

> The problem with egg files is that you can't use  
> "open(os.path.join(os.path.dirname(__file__),'myFile')" and I'd need to  
> rewrite such code which I'd like to avoid if possible. Also, I don't  
> know whether leaving the python scripts packed inside the egg file is  
> slower for execution or not...

There are many other problems with egg files... (did I menction that I  
hate eggs?)

Gabriel Genellina

More information about the Python-list mailing list