[Python-Dev] Single-file Python executables (was: Computed Goto dispatch for Python 2)

Chris Barker chris.barker at noaa.gov
Thu May 28 21:24:28 CEST 2015


OK, I'm really confused here:

1) what the heck is so special about go all of a sudden? People have been
writing and deploying single file executables built with C and ++, and
whatever else? forever. (and indeed, it was a big sticking point for me
when I introduced python in my organization)

2) Why the sudden interest in this as core a Python issue? I've been using
Python for desktop apps, on primarily Windows and the Mac for years -- and
had to deal with py2exe, py2app, etc. forever. And it has been a very very
common question on the various mailing lists for ages: how do I deploy
this? how do I make it easy to install? The answer from the developers of
cPython itself has always been that that's a third party problem -- and go
look for py2exe and friends to solve it. And that it is a solved-enough
problem. The biggest "unsolved" issues are that you get a really  big
application.

Don't get me wrong -- I've wanted for years for it to be easier to deploy
python-based apps as a single thinking for users to easily install and
uninstall where they don't need to know it's python -- but what the heck is
different now?

3) There was mention of a platform-neutral way to do this. Isn't that
simply impossible? The platforms are different in all the ways that matter
for this problem: both technical differences, and conventions. Which isn't
to say you couldn't have one API to produce a single "thing" executable, so
it would look like one solution for multiple platforms to the user. But the
end product should be (would have to be) a different beast altogether.

And doesn't PyInstaller already provide that (may it can't do
single-file...)

Anyway -- if there really is a new interest in this problem such that
people will put some time into, here are some thoughts I've had for ages:

The big one is Separation of concerns: in order to build a single "thing"
executable, you need three things:
  a) An API to for the developer to specify what they want
  b) Figure out what needs to be included -- what extra modules, etc.
  c) A way to package it all up: App bundle on the Mac, single file
executable on Windows (statically linked? zip file, ???)

That third one -- (c) is inherently platform dependent -- and there "is
more than one way to do it" even on one platform. But it sure would be nice
if the API between a) b), and c)  could be unified so we could mix and
match different implementations.

And, of course, if cPython itself could be built in a way that makes
step(c) easier/less kludgy great!

-Chris


On Thu, May 28, 2015 at 9:54 AM, Donald Stufft <donald at stufft.io> wrote:

>
>
> On May 28, 2015 at 12:24:42 PM, Chris Barker (chris.barker at noaa.gov)
> wrote:
> > I'm confused:
> >
> > Doesn't py2exe (optionally) create a single file executable?
> >
> > And py2app on the Mac creates an application bundle, but that is
> > more-or-less the equivalent on OS-X (you may not even be able to have a
> > single file executable that can access the Window Manager, for instance)
> >
> > Depending on what extra packages you need, py2exe's single file doesn't
> > always work, but last I tried, it worked for a fair bit (I think all of
> the
> > stdlib).
> >
> > I don't know what PyInstaller or others create. And I have no idea if
> there
> > is a linux option -- but it seems like the standard of practice for an
> > application for linux is a bunch of files scattered over the system
> anyway
> > :-)
> >
> > Yes, the resulting exe is pretty big, but it does try to include only
> those
> > modules and packages that are used, and that kind of optimization could
> be
> > improved in any case.
> >
> > So is something different being asked for here?
>
> All of those solutions “work” to varying degrees of work, almost all of
> them rely
> on hacks in order to make things “work” because the ability to do it isn’t
> built
> into Python itself. If the critical pieces to execute in this way was
> built into
> Python itself, then those tools would work a whole lot better than they
> currently
> do.
>
> >
> > Barry Warsaw wrote:
> > >> I do think single-file executables are an important piece to Python's
> long-term
> > competitiveness.
> >
> > Really? It seems to me that desktop development is dying. What are the
> > critical use-cases for a single file executable?
>
> The desktop isn’t dying, Mobile is becoming a very important thing of
> course,
> but that’s just because people are using devices *more* to account for the
> use of Mobile, they aren’t really using their Desktop’s less.
>
> See:
> http://blogs.wsj.com/cmo/2015/05/26/mobile-isnt-killing-the-desktop-internet/
>
> >
> > And I'd note that getting a good way to use Python to develop for iOS,
> > Android, and Mobile Windows is FAR more critical! -- maybe that's the
> same
> > problem ?
> >
>
> It’s not the same problem, but it’s also not very relevant. Volunteer time
> isn’t
> fungible, you get what people are willing to work on regardless of whether
> it
> will help Python as a whole. It’s also not an either/or proposition, we
> can both
> improve our ability to develop under iOS/Android/etc and improve our
> ability to
> handle desktop applications.
>
> ---
> Donald Stufft
> PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
>
>
>


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150528/89f3334c/attachment.html>


More information about the Python-Dev mailing list