[Distutils] [Catalog-sig] Simpler Python package management: the "egg" command

Phillip J. Eby pje at telecommunity.com
Mon Aug 20 20:01:02 CEST 2007

At 10:59 AM 8/17/2007 +0100, Luis Bruno wrote:
>The really *big* -1 this has is that I'm basically gonna be using
>--single-version-externally-managed eggs (which makes it impossible to
>have multiple "inactive" versions and require() them, if I understood
>Phillip Eby correctly).

You can have inactive versions and require() them, they just have to 
be .egg files or directories.  You can have a "default" version 
that's installed --single-version, e.g. by a system package manager 
such as RPM.

>I was thinking "sync local" re-gets the repository's Packages
>master-list. Then you read in the locally installed ones (which is a
>matter of traversing sys.path and looking for the .egg-info files; I
>think those are now (as of 2.5) expected to be there.

Please, please, *please* use the published APIs in pkg_resources for 
this.  Too many people are writing tools that inspect egg files and 
directories directly -- and get it only partly right, making 
assumptions about the formats that aren't valid across platforms, 
Python versions, etc., etc.

In general, if you are doing absolutely *anything* with on-disk 
formats of eggs, and you didn't read enough of the docs to find the 
equivalent APIs, it's a near-certainty that you don't understand the 
format well enough to write your own versions.  Meanwhile, 
pkg_resources is proposed for inclusion in the Python 2.6 stdlib, so 
it's not like it's going to be hard to get a hold of.

In this particular example, by the way, if you want to find all 
locally installed packages, you probably want to be using an 
Environment instance, which indexes all installed packages by package 
name, and gives you objects you can inspect in a variety of ways, 
including using .get_metadata('PKG-INFO') calls to read the .egg-info 
files -- or .egg-info/PKG-INFO, or EGG-INFO/PKG-INFO, or whatever 
file is actually involved.  (This is why you need to use the API -- 
there are a lot of devils in the details.)

>I think easy_install -f <url> can work against an Apache directory


>I thought that was the whole point behind it, really.

One of them, anyway.  There are other aspects besides -f that work 
for directory indexes, such as PyPI "home page" and "download" URL links.

More information about the Distutils-SIG mailing list