On Fri, 20 Nov 2020 at 09:12, Steven D'Aprano email@example.com wrote:
On Thu, Nov 19, 2020 at 11:24:32PM +0000, Paul Moore wrote:
I'm not sure about an installer. To me that means integrating with system "installed apps" mechanisms. But I *would* support building an "unzip and run" style of distribution.
Don't zip files support self-extracting archives? Google says that the most common archivers (WinZip, 7-Zip, WinRar, etc) do, and I've seen people talking about making self-extracting archives on Ubuntu.
The low-hanging fruit here is probably for Python's zip library to support self-extracting archives for the most common platforms.
That would involve bundling native "zip header" self-extractors for all platforms. It would be an interesting addition to the zipfile module, but I'm not sure it's "low hanging" fruit. On the other hand, I did a quick check of zip tools (on Windows) and it's surprisingly hard to find tools that convert an existing zip into a self-extracting exe, so having the functionality in Python would be good...
Ironically, the "executable stub" needed to prepend to a zipfile can't easily be written in Python, because it's a case where a native exe is absolutely necessary...
For me, the low-hanging fruit still seems to be to add a couple of features:
1. Add the ability for zipapp to prepend a launcher for Windows, so zipapps can be built that "run natively" on Windows (Unix and MacOS don't need this, because for them, shebangs are handled by the OS, not by the language runtime). It *might* be possible to use the py.exe launcher, if not the sample code in the zipapp docs is probably sufficient. 2. Add something that makes writing MacOS "app bundles" from zipapps easier. That could be part of the zipapp module, or a standalone module. 3. (Maybe not as low hanging, and something of a side issue) Add something to zipapp that uses pip to bundle 3rd party libraries. This is fragile, though, because zipapps don't handle C extensions. External tools like shiv do this better.
One of these days, I'm just going to bite the bullet and do number (1), and maybe (3). But (1) needs me to dust off my C skills, which are very rusty these days :-(
The harder question is around bundling an interpreter with a zipapp. That needs us to actually *have* a version of the interpreter intended for bundling, and that only exists right now on Windows. So while I'd like to see it for Windows, I think it's a platform-specific feature at least for now. And maybe that's where some of the differences in opinion come from (bundling an interpreter is much less frowned on, for better or worse, in Windows environments than it is on Linux).