[Python-Dev] PEP 441 - Improving Python ZIP Application Support

Paul Moore p.f.moore at gmail.com
Tue Feb 17 22:45:32 CET 2015


On 17 February 2015 at 21:10, Barry Warsaw <barry at python.org> wrote:
> The actual "import an extension module" support in zipimport does need to be
> cross-platform, but it can work differently depending on the platform.  For
> example, if extended-dlopen is available on your Linux machine, zipimport
> could just use that.  For a traditional-dlopen-only machine, it would
> copy-to-filesystem.   It would do whatever Windowsy thing makes sense over
> there too.

Oh, absolutely. As long as the functionality is supported everywhere,
the implementation can be whatever is needed.

> I'm much less concerned about the cross-platform portability of the resulting
> pyz files.  There's lots of reasons why an application built in (or for) my
> Linux machine might not work properly on your Windows machine, but FWIW if it
> were the only problem, doing a native rebuild on the target platform (or via
> supported cross-building) would be fine with me.

Yeah, it's not at all clear to me what people's intended use cases are
for pyz files.

Personally, I want them for writing scripts I can copy between my
various PCs without hassle. (So single file saves me from having to
make sure I have dependencies installed everywhere, but sys.executable
ties me to a specific install location). Your use case seems similar
(but on Unix, where there's less likelihood that Python will be
installed in different places).

I don't know if anyone is seeing them as a distribution format (i.e.,
they put their software up on their website for anyone to use).

If Python zip applications got the ability to include binary
extensions, they would *definitely* not be portable (we don't want to
go down the route of wheel-like compatibility tags for an application
file format).

Currently, I'm trying to leave this aspect of the PEP open, so the PEP
describes what the format is and how it works, but doesn't try to
imply particular use cases. That way people can use it how they
prefer, and the PEP doesn't put people off with a lot of caveats. My
current draft of the documentation page for the zipapp module includes
an example of setting a shebang line, with some notes on issues to
consider for a portable shebang line if you propose distributing your
application - but that's as far as I want to go.

Paul


More information about the Python-Dev mailing list