[Distutils] Re: Eggs Meta-Data

Phillip J. Eby pje at telecommunity.com
Sun Apr 17 01:14:06 CEST 2005


At 07:31 PM 4/16/05 +0100, James Gardner wrote:
>Hi Phillip,
>
>I've got a couple of questions about Eggs, if I should be addressing it to 
>a mailing list rather than you could you please let me know?

I imagine that the Distutils-SIG is probably a good place for discussion, 
so I'm cc:ing my response there.


>I think Eggs is very much needed and will be extremely useful. I'd like to 
>start organising my packages in a sensible structure for eggs. The 
>package.eggs-info directory currently doesn't recursively include 
>directories within eggs-info, just single files. Is this deliberate or an 
>unfinished part of the code?

It's deliberate; nobody has presented a compelling use case for putting 
anything other than a handful of files in the metadata directory.


>Is eggs-info designed to contain documentation, scripts and examples as well.

No; these would generally go in the package directories, where they are 
then retrievable via the pkg_resources module.  The metadata is primarily 
for things that apply to the distribution as a whole, and that are needed 
by applications or servers to identify e.g. the role or contents of the 
distribution.


>  If so is there a convention whereby scripts can be copied to the Scripts 
> directory of the Python installation so that they can be easily executed 
> if an egg is actually installed?

If they're included as top-level modules, then "python -m" is sufficient to 
invoke them if the .egg is on sys.path or PYTHONPATH.  There is no 
"installation" of eggs, which is at least part of their charm.  :)


>Couldn't a similar thing happen with documentation so a user could have 
>one central place for documentation? Wouldn't this be useful?

It might be useful to define some kind of metadata file to identify how to 
find documentation files within the included packages, but I don't really 
see the point of putting the documentation itself in the metadata 
directory, aside from perhaps release notes and the like.

Note that eggs are primarily intended to be an *execution* format, not an 
installation tool or packaging system.  So really the metadata is intended 
for programs to read and use, not for humans.  Applications that need 
plugins often have some kind of configuration or deployment file that 
specifies how the accompanying code is to be used by the application, and 
that's what the metadata directory is for.


>P.S. If you want to recursively include all files in eggs-info add 
>copy_tree to line 9 of setuptools\command\bdist_egg.py
>
>from distutils.dir_util import create_tree, remove_tree, ensure_relative, 
>mkpath, copy_tree
>
>and change line 190 and surrounding lines to:
>
>        if self.egg_info:
>
>            copy_tree(self.egg_info, egg_info)

Actually, you've now convinced me that I shouldn't do this, so that people 
aren't tempted to cram all sorts of crazy things in there.  ;)



More information about the Distutils-SIG mailing list