[IPython-dev] Distribution via "Easy Install"?

Robert Kern robert.kern at gmail.com
Thu Dec 22 16:08:40 EST 2005


Fernando Perez wrote:
> Hey Robert,
> 
> as usual, thanks for the useful, detailed reply.

My pleasure.

> Robert Kern wrote:

>>* ipython builds as an egg just fine out-of-box. It is not zip-safe since it
>>uses a few __file__ thingies, but that's okay. easy_install correctly unpacks
>>the egg. You can build ipython as an egg without changing the source:
>>
>>  $ python -c "import setuptools; execfile('setup.py')" bdist_egg
>>
>>Of course, easy_install will do this for you.
> 
> This is for _building_ an egg, right? 

Correct.

> Should I distribute the .egg in this 
> manner as well at ipython/dist?  I'm perfectly happy installing setuptools and 
> adding the above to my release script, but I don't know if that's the 
> preferred mechanism.

Since ipython is pure Python, yes, providing an egg in addition to the source
tarball would be great. It won't have the documentation, though, unless if it is
included as package_data.

>>* The /usr/bin/ipython contents that Ville posted is automatically generated by
>>easy_install (the actual scripts live inside the egg; the scripts installed to
>>/usr/whatever/bin are bootstraps to load and run those scripts), so Fernando
>>doesn't need to worry about wrapping anything with try: except: blocks.
> 
> Do you mean that we shouldn't add 'import egg_stuff' _anywhere_ in the ipython 
> code, or do you refer only to the scripts?  If the latter, which components do 
> still require egg yolks in them?

The only places where you might want to use pkg_resources are the places where
you use __file__ and such. Doing that would make the egg zip-safe so it doesn't
have to be unpacked, but it's not necessary. Specifically, here are the things
that make the egg not zip-safe:

zip_safe flag not set; analyzing archive contents...
IPython.deep_reload: module references __path__
IPython.ipmaker: module references __file__
IPython.Magic: module MAY be using inspect.getabsfile
IPython.OInspect: module MAY be using inspect.getsource
IPython.OInspect: module MAY be using inspect.getabsfile
IPython.ultraTB: module MAY be using inspect.getinnerframes

So no, there are no *requirements* at this time to import any egg_stuff in the
ipython package or the setup.py. It would enable some minor conveniences, but at
the cost of a (buildtime or runtime) dependency on setuptools and Python 2.3.
It's probably not worthwhile at this time.

>>* I think the only thing that really needs to happen now is that the PyPI record
>>needs a link to the actual download location or the tarballs could be uploaded
>>to PyPI itself.
> 
> I can do that, as I already register.  Should this be a link to the actual raw 
> .tar.gz?

A link to http://ipython.scipy.org/dist/ is sufficient. easy_install can
screenscrape that page just fine. In fact, this works right now:

[src]$ easy_install -f http://ipython.scipy.org/dist ipython
Reading http://ipython.scipy.org/dist
Searching for ipython
Best match: ipython 0.6.15
Downloading http://ipython.scipy.org/dist/ipython-0.6.15.tar.gz
Processing ipython-0.6.15.tar.gz
Running ipython-0.6.15/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-PMohs7/ipython-0.6.15/egg-dist-tmp-yqP99d
zip_safe flag not set; analyzing archive contents...
IPython.deep_reload: module references __path__
IPython.ipmaker: module references __file__
IPython.Magic: module MAY be using inspect.getabsfile
IPython.OInspect: module MAY be using inspect.getsource
IPython.OInspect: module MAY be using inspect.getabsfile
IPython.ultraTB: module MAY be using inspect.getinnerframes
Adding ipython 0.6.15 to easy-install.pth file
Installing ipython script to /usr/local/stow/local/bin
Installing pycolor script to /usr/local/stow/local/bin

Installed
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ipython-0.6.15-py2.4.egg
Processing dependencies for ipython
[src]$ ipython
Activating auto-logging.
Current session state plus future input saved to: /Users/kern/.ipython/ipython.log
Logging mode:  backup
*** Loaded SciPy
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.15 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]:

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the IPython-dev mailing list