[Python-Dev] Minipython

Michael Hudson mwh at python.net
Sun Sep 24 01:36:41 CEST 2006

Milan Krcmar <krcmar at datinel.cz> writes:

> I would like to run Python scripts on an embedded MIPS Linux platform
> having only 2 MiB of flash ROM and 16 MiB of RAM for everything.
> Current (2.5) stripped and gzipped (I am going to use a compressed
> filesystem) CPython binary, compiled with defaults on a i386/glibc
> Linux, results in 500 KiB of "flash". How to make the Python interpreter
> even smaller?
> - can I completely drop out lexical analysis of sourcecode and compilation
>   to bytecode? is it relevant enough to the size of interpreter?

I don't think there's an configure flag for this or anything, and it
might be a bit hairy to do it, but it's possible and it would probably
save a bit.

There is a configure option to remove unicode support.  It's not
terribly well supported and stops working every now and again, but
it's probably much easier to start with.

There was at one point and may still be an option to not include the
complex type.

> - should I drop "useless" compiled-in modules? (what I need is a
>   replacement for advanced bash scripting, being able to write more
>   complex scripts and avoid forking tens of processes for things like
>   searching filesystem, formating dates etc.)

Yes, definitely.

> I don't want to re-invent the wheel, but all my attempts at finding
> Python for embedded systems ended in instructions for embedding
> Python in another program :-)
> Can you give me any information to start with? I would prefer stripping
> current version of Python rather than returning to a years-old (but
> smaller) version and remembering what of the new syntax/functionality to
> avoid.

Well, I would start by looking at what is taking up the space...


  C++ is a siren song.  It *looks* like a HLL in which you ought to
  be able to write an application, but it really isn't.
                                       -- Alain Picard, comp.lang.lisp

More information about the Python-Dev mailing list