PEP XXX Yet Another Python .ZIP File Extension One reason Python ZIP applications have not been more widely adopted is because they have no Windows file association and would have to be confusingly named .py to be invoked by the interpreter. Henceforth, files with the extension .pyz shall be known as Python ZIP files. They consist of a ZIP format archive containing at minimum __main__.py, concatenated to two lines #!python or #!pythonw (or the full path to the interpreter), and an explanation # This is a ZIP format archive executable by the Python interpreter. The launcher will be updated to understand this format and Python will register this filename association when it is installed. On Thu, Mar 28, 2013 at 7:40 AM, Philippe Ombredanne <pombredanne@nexb.com> wrote:
On Tue, Mar 26, 2013 at 11:08 AM, Paul Moore <p.f.moore@gmail.com> wrote:
On 26 March 2013 09:49, Philippe Ombredanne <pombredanne@nexb.com> wrote:
Would anyone know of a better way to package things in a single python-executable bootstrapping script file without obfuscating the source contents in compressed/encoded/obfuscated byte arrays?
Packaging as a zip file is a good way - but on Windows the file needs to be named xxx.py (which is surprising, to say the least :-)) for the relevant file association to be triggered (and on Unix, a #! line needs to be prepended). Paul: I was not talking about this type of zips, but rather the same used in virtualenv, i.e. a string in a .py file that contains an encoded zip. That string is then decoded and unzipped at runtime as in here: https://github.com/pypa/virtualenv/blob/develop/virtualenv.py#L1933
This is not a zip, not an egg, not a wheel but some egg-in-py, zip-in-py or wheel-in-py and is similar to a shar shell archive.
My point was that on the one hand, I like the fact that everything is self contained in one single .py file that you can execute right away. On the other hand, I find it somewhat discomforting as an emerging best way to package and distribute self-contained bootstrap scripts. Yet I cannot think of a better way atm: for instance splitting things in non-encoded non-binary plain strings would be quite weird too.
Virtualenv does it, distil is doing it now, pip tried some of it here https://github.com/pypa/pip/blob/develop/contrib/get-pip.py In contrast, buildout, distribute and setuptools bootstrap scripts do not embed their dependencies and either try to get them satisfied locally or attempt to download the requirements. Having some support to do self-contained bootstrap scripts (as in requiring no network access and embedding all their dependencies) using this shar style could be something to consider normalizing?
-- Philippe Ombredanne
+1 650 799 0949 | pombredanne@nexB.com DejaCode Enterprise at http://www.dejacode.com nexB Inc. at http://www.nexb.com _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig