Smallest Standalone Distributable Possible?
Kragen Sitaker
kragen at dnaco.net
Mon Apr 2 21:36:13 EDT 2001
In article <3ac91f8d_2 at news4.newsfeeds.com>, Dry Ice <nomail at nomail.com> wrote:
>The goal is RAD of a small-medium sized application in Python.
>The application will be standalone, i.e.,
> it will install into a single folder,
> it will install NOTHING anywhere else
> (except a startup icon),
> it will not touch the registry,
> and it will require the existance or
> installation of nothing outside its folder.
>
>Is this possible in Python?
Yes. I want to do this, except I want it to be a single file. Has
anyone else done this?
>If so, how large might the distributable package be
>and what might it contain, at minimum?
For 1.5.2, I think it can be around 700K, containing the Python
interpreter, the bytecodes for whatever Python modules you're using,
the code for whatever dynamically-loadable extension modules you're
using, and a tiny amount of glue code. I estimate that my application
would be about a megabyte this way.
The Pippy PyVM is supposedly 200K; it'd be nice to be able to do that
on Win32 and Unix. (At least for code that doesn't use eval() or
friends.)
Has anyone done this? I assume it's just a matter of finding the right
set of .o and .pyc files, converting the .pyc files to .o files
containing the .pyc files as strings, feeding the lot to a linker, and
writing some simple generic glue code: PyMarshal_ReadObjectFromString,
some error checking, PyEval_EvalCode, and some amount of tricky stuff
to make 'import' behave, i.e. only load stuff from strings.
--
<kragen at pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Perilous to all of us are the devices of an art deeper than we possess
ourselves.
-- Gandalf the White [J.R.R. Tolkien, "The Two Towers", Bk 3, Ch. XI]
More information about the Python-list
mailing list