FAQ
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.

What can I strip off Python? Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090311/f44850b4/attachment.htm>

Search Discussions

  • Christian Heimes at Mar 12, 2009 at 1:49 am

    Royce Wilson schrieb:
    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.

    What can I strip off Python? Thanks.
    I start by stripping off all documentation in Docs/, the Lib/test
    directory with unit tests, the Tools/ directory with optional stuff and
    all Windows related code in PC/, PCBuild and PCBuild8. Optional
    components like bsddb, tk and curses take up some space, too. Last but
    not least you can put all .py and .pyc files in a zip file. The file
    must be called "/usr/local/lib/python25.zip" if sys.prefix is equal to
    "/usr/local".

    Christian
  • Gabriel Genellina at Mar 12, 2009 at 2:02 am
    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
  • Royce Wilson at Mar 12, 2009 at 2:41 am

    On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson 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.htm>
  • Gabriel Genellina at Mar 12, 2009 at 3:27 am
    En Thu, 12 Mar 2009 00:41:18 -0200, Royce Wilson <rww993 at gmail.com>
    escribi?:
    On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson 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?
    Start python with the -S option

    --
    Gabriel Genellina
  • Royce Wilson at Mar 12, 2009 at 6:52 pm
    Thanks, much better. What exactly do I lose when I launch python without
    site.py?

    On Wed, Mar 11, 2009 at 10:27 PM, Gabriel Genellina
    wrote:
    En Thu, 12 Mar 2009 00:41:18 -0200, Royce Wilson <rww993 at gmail.com>
    escribi?:
    On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson 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?
    Start python with the -S option


    --
    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/20090312/e9dac842/attachment.htm>
  • Royce Wilson at Mar 12, 2009 at 10:39 pm
    Is there a way to veiw the modules without import sys? Thanks again.
    On Thu, Mar 12, 2009 at 1:52 PM, Royce Wilson wrote:

    Thanks, much better. What exactly do I lose when I launch python without
    site.py?


    On Wed, Mar 11, 2009 at 10:27 PM, Gabriel Genellina <
    gagsl-py2 at yahoo.com.ar> wrote:
    En Thu, 12 Mar 2009 00:41:18 -0200, Royce Wilson <rww993 at gmail.com>
    escribi?:
    On Wed, Mar 11, 2009 at 9:33 PM, Royce Wilson 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?
    Start python with the -S option


    --
    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/20090312/55db2a9b/attachment.htm>
  • Gabriel Genellina at Mar 13, 2009 at 3:30 am
    En Thu, 12 Mar 2009 20:39:47 -0200, Royce Wilson <rww993 at gmail.com>
    escribi?:
    Is there a way to veiw the modules without import sys? Thanks again.
    sys is a builtin module. You don't add any dependency by importing it, if
    that's your concern.

    --
    Gabriel Genellina
  • Christian Heimes at Mar 12, 2009 at 11:42 pm

    Royce Wilson schrieb:
    Thanks, much better. What exactly do I lose when I launch python without
    site.py?
    Why do you want to strip Python off everything useful? A bare
    interpreter without the standard library isn't useful for anything.

    Christian
  • Gabriel Genellina at Mar 13, 2009 at 3:44 am
    En Thu, 12 Mar 2009 16:52:38 -0200, Royce Wilson <rww993 at gmail.com>
    escribi?:
    Thanks, much better. What exactly do I lose when I launch python without
    site.py?
    site.py completes the module search path (sys.path), adding the
    site-packages directory, processing .pth files, and other per-site and
    per-user configurations. Also, configures some options in the interactive
    interpreter (processing PYTHONSTARTUP, enabling interactive help()
    support, and the builtin quit/exit/license/credit/copyright functions)

    Disabling site.py (and cropping the standard library) only makes sense for
    an embedded interpreter - a "normal" installation, for "general" usage,
    should be complete IMHO.

    --
    Gabriel Genellina

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMar 12, '09 at 1:09a
activeMar 13, '09 at 3:44a
posts10
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase