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