Now for some of my cows

/2007/Apr/10   thoughts, notes and mooo...

<  April 2007  >
SuMoTuWeThFrSa
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
2930     
misc.

Tue, 10 Apr 2007 Two easy_install tricks   >>

Tue, 10 Apr 2007 Two easy_install tricks   >>

Two easy_install tricks I should remember:

1) Package name alias

Whenever the name for a Python package as listed on the cheeseshop is different from the name it will have on the PYTHONPATH (e.g. when it is installed in site-packages or something). easy_install can get confused.

One prominent example is PIL. PIL is installed using easy_install under the name Imaging, not PIL. So, a line in your package's setup.py to require PIL:

setup(
     ...
     install_requires=[
         ...
         'PIL'
         ]
 )

Doesn't work, you have to say this:

setup(
    ...
    install_requires=[
        ...
        'Imaging'
        ]
)

But then easy_install gets confused, because the downloaded egg is called something like PIL-1.1.6-py2.4-linux-i686.egg, not Imaging--1.1.6-py2.4-linux-i686.egg.

My solution for now: make an entry on a custom Python package index page (that I have anyway for internal packages), where the #egg=... fragment identifier is misued, like so:

<a href="http://www.effbot.org/downloads/Imaging-1.1.6.tar.gz#egg=PIL-1.1.6">
  PIL-1.1.6
</a>

(This fragment identifier is normally used by easy_install to point to subversion repositories).

See this thread on distutils-sig list archive for references.

2) HTTP Basic Authentication

Easy_install can deal with a Python package indices that requires Basic Authencticaion. You just use a credentialed URL, something like:

easy_install -f http://username:secret@domain.tld/path/to/index

If downloading the packages that is being refered to on this index page needs authentication too, you have to make sure the URLs to the packages are relative URLs. Only in that case, the easy_install command remembers the credentials provided.

See this thread on the distutils-sig list archive for reference.