[Python-Dev] PEP 273: Import Modules from Zip Archives

Gordon McMillan gmcm@hypernet.com
Wed, 31 Oct 2001 16:04:31 -0500


> >>>>> "FL" == Fredrik Lundh <fredrik@pythonware.com> writes:
> 
>   FL> can anyone explain why I shouldn't be allowed to ship, say,
>   FL> PIL's Python code in a version-independent ZIP file?

Jeremy Hylton: 
> Excellent point!

Being the permissive sort, I'd say you should be allowed. But I 
think it would be foolish.
 
> We ought to collect some requirements/goals for the ZIP import
> stuff. The current draft of the PEP is a little thin on
> motivation.

Speed, ease of deployment, minimal disk space. MacPython 
does it, Jython does it, Installer's been doing it since '98 
(although it doesn't use zip format archives).
 
> Requirement: A ZIP archive be usable any version of Python that
> supports ZIP-based imports.

Hmm. You want .pyc's with every known magic number (there 
goes disk space)? Or just source and throw away the .pyc? 
Or maybe insert into the zip file? Either way, there goes 
speed.

Besides, as I noted, and Guido concurred, we need some way 
to handle extension modules "inside" packages, since they 
can't go inside the zip. On Windows, extensions are only 
usable by one version of Python.

This is silliness. I have clients with versions 1.52 to 2.1. I have 
a fair amount of code I reuse, and I keep it version-
independent. I have had to change something in it for every 
Python version to keep it version independent.

> It might also be nice to have a imputil- or ihook-based importer
> that works with older versions of Python.  

There's at least one imputil-based one that works with zipfile.

- Gordon