[Python-Dev] Add a -z interpreter flag to execute a zip file

glyph at divmod.com glyph at divmod.com
Thu Jul 12 11:33:59 CEST 2007


On 08:41 am, guido at python.org wrote:
>On 7/12/07, Thomas Wouters <thomas at python.org> wrote:

>>I disagree with both statements. The bagage is much less than 
>>zipimport
>>itself, which has proven to be quite useful. Nevertheless, zipimport 
>>built
>>into the interpreter was by no means necessary; current users of it 
>>could
>>have readily implemented it themselves, with no changes to Python.

I wonder, is it even necessary to say anything, after:
>+1.

?

But, since I so often object to new features, and there is a heavy 
Google bias in the existing survey sample, I would like to say that I 
had a problem several months ago in a _radically_ different environment 
(Twisted running on an embedded system, Zipfile of PYCs used to shave 
off as much disk space and startup time as possible) where having the 
subtleties of a "-z" flag figured out already would have saved me a 
_ton_ of work.  I was already aware of the shell-header trick, but 
discovering all the environment-setup details was tedious and 
distracting enough to make me give up and switch to writing a bunch of 
hard-to-test /bin/sh code.

It wasn't a bad project by any means, and Python worked out even better 
than expected (we weren't even sure if it would be able to load into the 
memory available, but it turns out that being able to do everything in a 
single process helped a lot) but a -z option would have been that much 
more impressive :).

In fact, I distinctly remember thinking "You know, if Python had an 
equivalent to Java's '-jar' option, this would be a whole lot easier."

(Even better, on this _particular_ project, would have been a generic 
"run this thing-which-looks-like-a-sys.path-entry" standard format, 
which could have been switched for different deployments to a directory, 
a zipfile, or the result of freezing.  Perhaps that's starting to get 
too obscure, though.)


More information about the Python-Dev mailing list