[Pythonmac-SIG] shrink app bundle size (removing unused stuff)?

Ronald Oussoren ronaldoussoren at mac.com
Sat Mar 10 17:47:25 CET 2012


On 9 Mar, 2012, at 16:33, Ronald Oussoren wrote:

> 
> On 9 Mar, 2012, at 10:55, Carlos Grohmann wrote:
> 
>> I think that if the 'excludes' weren't overwritten by the
>> wx/numpy/matplotlib/etc recipes, it would be easier to fine-tune our
>> options (maybe run the recipes first and aftrer run the excludes?)
> 
> The matplotlib issue seems to be a bug that's not related to recipes: py2app copies package data into the application bundle, and this code accidently also copied all subpackages like the matplotlib.test package.   I have a patch, but need to test if this actually fixes the bug before I commit.

It didn't, but I did make some progress:

1) I added a py2app recipe that does the right thing with the pubsub library in wxPython. That library uses __path__ hacks and that confuses modulegraph (and hence py2app). Because of this you no longer have to explicitly include 'wx' in the application bundle

2) I tweaked the matplotlib recipe in py2app, it no longer copies the entire package but adds a hook to tell matplotlib where its data is. This solution is not fully complete yet, I'm currently including mpl-data twice (once in Resources, once in site-packages.zip) and the later copy is not needed.

With this the application bundle already shrinks a little (curently 123 MByte, before I started it was about 160 MByte). About 70 Mbyte of this is wx itself (the wxWidgets library and wxPython extensions). Another 21 MByte is because all of numpy is included, not just the bits that are actually needed. That's because of another py2app recipe which can hopefully be improved. 

I just pushed updates to modulegraph and py2app to my bitbucket repositories.

Ronald

> 
> Ronald
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4788 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20120310/9af4c283/attachment.bin>


More information about the Pythonmac-SIG mailing list