Python packages and egg directory

Can someone explain how egg directory directories are tied to their respective modules? For example, I have the following:

/usr/local/lib/python2.5/site-packages/quodlibet/ /usr/local/lib/python2.5/site-packages/quodlibet-2.0.egg-info/ 

I assume that the egg-info directory should make the corresponding module visible to setuptools (easy_install), right? If so, how does setuptools bind the egg information directory to the module directory?

Assuming I'm on the right track and for the sake of example ... If I wanted to make an existing package visible to setuptools, can I just symbolize the module directory and the directory with egg information directory of package sites? I would just try this myself, but I'm not sure how to check if a package is available for setuptools. Bonus points if you can also tell me how to check it :)

The main reason I'm trying to understand all this is that I would like to symbolize some of my modules in site packages so that I can make changes to them and have visible changes for scripts that use them, reinstall the egg from PyPI after each change.

+63
python setuptools egg
Nov 02 '08 at 2:26
source share
1 answer

.Egg-info directories are only created if the version --single-version-external-manage was used to install the egg. “Normally,” installing the egg would create one directory (or zip file) containing both code and metadata.

pkg_resources (which is a library that reads metadata) has a require function that can be used to request a specific version of a package. For the "old style", regular import, easy_install will crack the .pth file to get the egg directory on sys.path. For -single-version-external-manage, this hack is not needed because only one version will be installed (via the pacakging infrastructure of the system, for example, rpm or dpkg). Egg information is still enabled for applications that use require (or any other pkg_resources binding mechanism).

If you want to install the package using tight bindings, I recommend using "setup.py develop". This is a command from setuptools that does not actually install the egg, but makes it accessible to the entire site. To do this, it creates an egg-bound file so that pkg_resources can find it, and it processes the .pth file so regular import can find it.

+57
Nov 02 '08 at 6:40
source share



All Articles