[capi-sig] Deploying embedded Python

Andreas Raab andreas.raab at gmx.de
Thu Dec 20 22:16:56 CET 2007


Martin Poirier wrote:
> We do that for windows version of Blender (
> http://www.blender.org/ ) (other OSes are assumed to
> have a full python distro already).
> 
> What we did to select the different modules included
> was very arbitrary. We picked the minimal set of
> modules that was required by scripts we wanted to ship
> with Blender at this point. With passing releases, we
> added some more, trying to keep size low (one of the
> reasons we don't include the xml parsing modules,
> IIRC).
> 
> Currently, this includes os (and its dependencies),
> random, webbrowser, threading, struct, tokenize, ...

That sounds quite like the approach we'll be taking ;-) I'll check 
Blender to see how your subset compares to what I have right now.

> I really wouldn't recommend the method we used to get
> dependency, which was (if memory serves right) a mix
> of looking at the sources and trial/error on a test
> machine, adding missing dependencies until it worked.

Yes, this is one of the reasons why I'm asking. Despite the (rather 
nice) Python module system there doesn't seem to be much integrity 
checking for modules, i.e., whether the set of modules you have is 
logically consistent (if there is, please let me know). I think the only 
way to test this is to run a test suite and see if it works or not.

>> 2) How to isolate the embedded interpreter from
>> environmental effects.
> 
> That's an excellent question. I'm not sure if we came
> up with a viable solution for that problem either, so
> if anybody else would like to pitch in an answer, we'd
> appreciate too.

I think Anthony's message addresses this problem quite well.

>> 3) General advice about deploying embedded Python.
>> Pointers to web 
>> sites, general experience (good or bad) etc. are all
>> very welcome.
> 
> From experience, unless you want to limit python input
> to things included with the distribution of your
> software, I'd say limit the included modules to the
> bare minimum, otherwise it's easy to get to a point
> where you're pretty much including the whole Python
> distro anyway, so might as well ask your users to
> install that directly.
> 
> I hope that was a bit helpful.

Indeed you were. Thanks a bunch!

Cheers,
   - Andreas


More information about the capi-sig mailing list