[Python-Dev] Re: How to customize CPython to a minimal set

2020年7月23日 03:02:13 -0700

On 7/20/20 10:30 AM, Huang, Yang wrote:
> 
> Hi, all
> 
> There is a request to run python in a Linux-based embedded resource 
> constrained system with sqlite3 support.
> 
> So many features are not required, like posixmodule, signalmodule, hashtable 
> ...
> But seems there are some dependencies among the 
> Modules/Parser/Python/Objects/Programs...
> 
> Is there a way to tailor CPython 3 to a minimal set with sqlite3 (the less 
> syscalls the better) ? 
> Is it possible to do that?
CPython comes with the promise of all batteries included, however sometimes it
feels like a complete power plant. For packaging purposes, most Linux distros
make the decision to ship CPython as a set of runtime packages, and a set of
packages used for development (and building C extensions). Breaking that down
for the Debian/Ubuntu packages comes down to these sizes (unpacked,
uncompressed, on x86_64):
minimal:
5516K debian/libpython3.9-minimal
5856K debian/python3.9-minimal
stdlib:
8528K debian/libpython3.9-stdlib
624K debian/python3.9
development:
19468K debian/libpython3.9-dev
25804K debian/libpython3.9-testsuite
1232K debian/python3-distutils
668K debian/python3-lib2to3
548K debian/python3.9-dev
extra modules:
1648K debian/idle-python3.9
5208K debian/python3.9-examples
132K debian/python3-gdbm
844K debian/python3-tk
What you don't see from the sizes, are the extra dependencies which add to the
size, e.g. the X stack for tk, or readline/curses/crypto for stdlib.
The "minimal" set may sound nice, however it's not used in practice, because the
set is not well defined, and it's difficult to keep the minimal set as a
self-contained set of stdlib modules, and the minimal usually keeps growing,
never shrinks.
It looks like this "minimal" set is even too much for your purposed, so you
would have to scale down this set even further.
Matthias
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/OZY63O24XP535PQYBAYNFXRF5S3PDV3E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to