Minimilistic Python on Linux?

Royce Wilson rww993 at gmail.com
Wed Mar 11 22:41:18 EDT 2009


On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson <rww993 at gmail.com> wrote:

> Thanks for the quick responses. When I view sys.modules I get this:
>
>  sre_compile _collections locale _sre functools encodings site operator io
> __main__ copyreg _weakref abc builtins encodings.cp437 errno sre_constants
> re encodings.latin_1 collections ntpath nt genericpath stat zipimport
> _codecs encodings.utf_8 encodings.cp1252 sys codecs _bytesio _thread os.path
> _functools _locale keyword signal _stringio _weakrefset encodings.aliases
> sre_parse os _abcoll _fileio
>
> Each module is seperated by a space.
>
> Can you give me in instructions on how to remove the site.py dependencies?
> BTW I'm using Python 3.0 as the point is to "modernize" linux.
>
>   On Wed, Mar 11, 2009 at 9:02 PM, Gabriel Genellina <
> gagsl-py2 at yahoo.com.ar> wrote:
>
>> 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
>>
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090311/307c9d36/attachment-0001.html>


More information about the Python-list mailing list