Minimilistic Python on Linux?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Wed Mar 11 22:02:15 EDT 2009
En Wed, 11 Mar 2009 23:09:51 -0200, Royce Wilson <rww993 at gmail.com>
escribió:
> I'm working on a minimilistic linux project and would like to include
> Python. However, since Python is around 17MB (compressed) and previous
> releases of this linux distro are under 100MB (compressed) standard
> Python
> releases are much to large. I just need the runtime libs of Python, the
> absoulute bare necesties. I do not need any kind of GUI. Also, with the
> standard library, I would like to remove all the files execpt the
> ones Python needs to run and only add new ones as required.
I think Python doesn't *require* any external module to be able to start.
"site.py" is searched, but may be missing. Probably the interpreter
executable alone is enough (but I've never tested it!). Anyway, most
Python users would expect all the standard modules to be available,
though... part of the usefulness of the language comes from its "batteries
included".
As a test, you might start with a clean install, then invoke the
interpreter and look at sys.modules. The modules you find there (those
that are not built-in) would be the minimum you need to run Python. On
Windows I got this (this was not a true "clean" install, I just disabled
sitecustomize.py and unset my PYTHONSTARTUP variable): UserDict _abcoll
abc codecs copy_reg encodings functools genericpath linecache locale
ntpath os re site sre_compile sre_constants sre_parse stat types warnings.
Most of these are dependencies from "site.py"; if you omit it, the list is
even shorter (just "codecs" and the "encodings" package; note that some
modules are built-in in Windows but external on Linux).
So it looks that -apart from those few modules- you may include as much or
as few of the standard library as you want, but consider what your users
would expect to be available...
--
Gabriel Genellina
More information about the Python-list
mailing list