[IPython-dev] %install_ext question

Greg Novak greg.novak at gmail.com
Wed Apr 10 11:15:05 EDT 2013


On Tue, Apr 9, 2013 at 6:56 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> Ah, sorry, I had got confused. Python can *run* a zip file containing a
> __main__.py file. It can't import a zip file.
>

Well, it worked for me to import code from the zip file, as long as the zip
file itself is on sys.path, ie, sys.path += ['/path/to/module-name.zip']

So it seems to me the three options are:
1) Specify that single python files can be installed via install_ext,
otherwise use pip.  This is fine, pip is easy to use.
2) Allow install_ext to point to zip files and have install_ext unzip the
module into the extensions directory
3) Allow install_ext to point to zip files and modify the config file so
that sys.path is modified to contain the zip file itself on startup
thereafter.

Either 1 or 2 seems equally good to me and 1 has the advantage that it just
means modifying the docstring for install_ext to remove the reference to
the possibility of using zip files.

Option 3 seems a bit fragile compared to the other two, so I guess in the
end it doesn't really matter that python is capable of importing code
directly from zipfiles for this particular issue....

Thanks,
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130410/bb167406/attachment.html>


More information about the IPython-dev mailing list