[Distutils] eggs in Python path
Jim Fulton
jim at zope.com
Sun Jan 15 19:50:44 CET 2006
Phillip J. Eby wrote:
> At 10:46 AM 1/15/2006 -0500, Jim Fulton wrote:
>
>> The eggs quick guide
>> http://peak.telecommunity.com/DevCenter/PythonEggs#using-eggs
>> says that eggs can be installed by just putting them on sys.path.
>> This doesn't
>> seem to be enough though. A .pth file seem to also be necessary.
>>
>> Am I missing something?
>
>
> Two somethings. :)
>
> First, you *can* install an egg by putting it on sys.path. A .pth file
> is just one *way* of putting it on sys.path.
Ah
> What you're asking about is installing an egg by putting it *in a
> directory that's on sys.path*, which is a different thing. You can also
> do this, as long as you're using the pkg_resources API to request the
> egg, or it's one of your requirements specified by your egg.
>
> The only egg that absolutely *must* be in a .pth (or otherwise get onto
> sys.path) is the setuptools egg. As long as that's the case, then it is
> not necessary to have .pth files, because the act of require()-ing an
> egg will cause it and all its dependencies to be added.
Sure, but then you have to call require. :)
>
>> Or is the documentation incorrect?
>
>
> It might be a bit confusing about this issue, but I've so far found that
> changing it around doesn't help much. :( This is simply something so
> new to most people that they seem to project their existing thought
> process onto it no matter what it actually says, and then only get it
> after bumping into a problem or mental contradiction. If you think you
> can improve upon the comprehensibility without making it so complex that
> nobody will read it anyway, feel free to submit a patch. :)
I think that a sentance or 2 saying that when you talk about putting an egg
on sys.path or in PYTHONPATH you mean putting the path to the egg file in
the list of paths. I suggest that:
"If you have a pure-Python egg that doesn't use any in-package data files,
and you don't mind manually including the path to the egg file in sys.path
or in PYTHONPATH, you can use the egg without installing setuptools.
"
Would be much clearer.
The original text talks about putting the *egg* *on* sys.path or PYTHONPATH.
This is missleading in 2 ways:
1. You aren't putting the egg anywhere. You are putting the name of the egg
somewhere.
2. When we talk about putting something "on" a path, that suggests (at least to me)
that you'll be able to find it in one of the directories specified in the path.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Distutils-SIG
mailing list