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

Brian Curtin brian at python.org
Thu May 28 19:04:24 CEST 2015


On Thu, May 28, 2015 at 11:23 AM, 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?
>
> 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?

Donald mentioned one earlier: command line utilities. I want a single
CLI I can deploy to my customers that doesn't make them have to
install Python or even know it's Python at all. My users write code in
all types of languages on all OSes, but I should be able to produce
one thing that they can all use. Donald himself initiated the CLI in
particular I'm talking about, but Go is picking up steam here as we
have other utilities that quickly solved the "write one thing, every
user can run it immediately, no one knows/cares what it's written in"

When I worked on Ubuntu One, I was the Windows guy responsible for
making sure the end-user experience was the same there as it was on
Ubuntu. On Ubuntu we were a part of the base install and didn't have
to worry about much. On Windows we had none of that, not even the C
runtime, so we had some pre-installer work to do, and then a bunch of
py2exe hacking to make everything play nicely and transparently.


More information about the Python-Dev mailing list