I would like to patch up the Python source so I can statically link it into my Windows application (I am aware that this is not easy or even encouraged because of how especially the core modules get loaded).
Can I leave out certain "core modules" despite the name that suggests that they are required?
I'm thinking of _tkinter
, _ssl
and ssl
(not 100% sure whether I want to remove that one, yet), winsound
and w9xpopen
(it's only going to be used on the NT platform) here. Is that possible or will that break things in subtle ways?
NB: please, no need to mention that static linking is bad for some reason or another. For the case I need it, it would be the superior solution by far.
Not sure if you still needed this answer, given how long ago you asked this question, but I figured I'd leave some of the info I've found out, since I wondered the same thing:
Note: This is based on the source tree for Python 2.7.3
There's a few python modules that depend on the _ssl/ssl modules, but they all have error checking to support versions of Python without SSL, and will just disable that functionality.
The included python modules that make use of the ssl module are:
Since you're embedding it into your own app, I'd probably also part with _msi. (which would allow you to remove the msilib module)
If you went ahead and removed the extensions you mentioned, you'd always want to get rid of the following python modules from the Lib folder:
I'm assuming this is a GUI app, so you probably won't need the following Python modules:
Not sure what your app does/did, though, so I'll be conservative with the rest.
As for the builtin modules, written in C, I can't guarantee this to be 100% problem-free, but you should be able to remove some of the following, depending on what your application actually needs.
Probably some others here, too.