#1951 closed defect (was already fixed)

"one-file" executable for non-developers

Reported by: warner Owned by:
Priority: normal Milestone: undecided
Component: packaging Version: 1.9.2
Keywords: bbfreeze packaging install build Cc:
Launchpad Bug:

Description (last modified by zooko)

I'd like it if Tahoe users (not developers) could download a single file and run it, rather than pointing them at "quickstart" instructions that begin with a source download/checkout and then some build steps. And I'd love it if this meant we could reduce complexity (by reducing functionality) of our setup.py, because we'd no longer need to support a single simple command to acquire/build/locally-install dependencies.

For the one-file executable, I'm thinking bbfreeze, about or if that doesn't work then something homemade. I recently learned that you can concatenate a #!/usr/bin/env python line with a zipfile that contains a directory with an __init__.py inside it, and running the result will cause python to execute that __init__.py. This sounds like a better-supported version of what bbfreeze does (or maybe this is what bbfreeze uses these days, I dunno). We'd probably publish one version for linux, and a different one for windows. Maybe one per platform if their binary dependencies are different. I'd want each one to be self-contained: no dependency upon system-supplied libraries.

For the remaining setup.py, I'm thinking that maybe virtualenvs are the way to go. Developer instructions could look like:

  • create and activate a virtualenv somewhere
  • run python setup.py develop from the tahoe source tree, which will get python from the virtualenv, which will read requirements.txt and install everything therein to the virtualenv, then will pseudo-symlink tahoe itself into the virtualenv
  • run ./bin/tahoe, which has a #!/usr/bin/env python, and will thus use the virtualenv's python. Or, use the virtualenv's bin/tahoe.

I believe packagers usually build OS packages by running python setup.py install in a fakeroot environment, possibly with additional options to install the results into a local directory instead of /usr. And that they expect this install to not drag in any dependencies. So I'd like that to work for packagers.

I don't know how long-term installation should work, but I'd like some variant on sudo python setup.py install to work, maybe in the form of two separate commands (one to install dependencies, the second to install tahoe itself). Another option is to have developer/installers construct their virtualenv as above, then simply symlink the virtualenv's bin/tahoe into /usr/local/bin or something.

I think it's ok to require that developers get virtualenv and whatever it requires (pip, setuptools, etc) installed first, and that we shouldn't feel obligated to provide additional source code to install those for them.

Change History (7)

comment:1 Changed at 2013-04-22T22:24:12Z by warner

https://pypi.python.org/pypi/bbfreeze/ is the recently-updated bbfreeze package, which apparently knows how to copy system-supplied shared libraries and DLLs into the generated executable.

comment:2 Changed at 2014-07-16T00:54:16Z by zooko

  • Description modified (diff)

comment:3 Changed at 2014-07-29T20:55:02Z by daira

I'm pretty skeptical about this. We already got bbfreeze working once (#585), and it didn't really solve any problem that we actually had. Almost all of the setuptools bugs/misdesign that cause problems with a normal build, also cause problems with a bbfreeze build, except that the latter is actually worse because no developer uses it, and so it bitrots. Also, the result doesn't in practice work unless you have one per platform ABI variant.

I think we should be using virtualenv for everything. A single-file build cannot possibly meet developer requirements, and so it's always going to be a second-class citizen. A virtualenv build *can* meet both developer and end-user requirements.

Last edited at 2014-07-29T20:56:13Z by daira (previous) (diff)

comment:4 Changed at 2014-07-29T21:00:32Z by daira

  • Keywords bbfreeze packaging install build added

virtualenv-based packaging is #2255.

comment:5 Changed at 2015-01-13T18:04:43Z by daira

A one-file package for Mac OS X is #182.

A one-file package for Windows is #195.

I don't think a one-file package for other Unix platforms in general is feasible, but I'm open to counterarguments.

comment:6 Changed at 2015-05-08T19:11:06Z by warner

One note: I think I should have said __main__.py or main.py instead of __init__.py. See the last section (about the <script> argument) in https://docs.python.org/2.7/using/cmdline.html#interface-options .

comment:7 Changed at 2020-01-17T14:28:08Z by exarkun

  • Resolution set to was already fixed
  • Status changed from new to closed

There is a PyInstaller? package for Tahoe-LAFS now. This is almost a single-file executable. It's also tested on CI and has the advantage of being _minimally_ weird compared to normal installations.

Since it is very similar to bbfreeze and satisfies the "download one thing to run tahoe" I think this can be considered fixed.

Note: See TracTickets for help on using tickets.