[Pythonmac-SIG] py2app questions..

Chris Barker - NOAA Federal chris.barker at noaa.gov
Mon Apr 15 20:30:51 CEST 2013


Ronald et al,

As matplotlib seems to be responsible for bringing eveything else in,
I'm trying a different tack:

1) I've removed many of the recipes from my p2app distribution,
notably teh matplotlib one. So now the only recipe getting run is wx.

2) I know that matplotlib isn't going to work right, as there are
issues with matplotlib data, etc. So I've tried to remove it by adding
it to "excludes". However, it's getting included anyway, in the
site_packages zip file. (but doesn't work...)

But moving on...

I"ve added ['matplotlib'] to "packages".

Now I get it included, in full, in Resources/lib/python2.7, and non
longer in the site_packages zip, and the app works fine.

the matplotlib package is 64MB though, so it would be nice to trim it
down, but this isn't bad, and the total package is now 134MB, rather
than the 210MB I did have.

So I suggest that the matplotlib recipe should:

- remove matplotlib from the site_packages zip

- install the matplotlib package in it's entirety (though maybe strip
out the *.py files...., and things like tests, etc.)

- not run matplotlib through modulegraph -- whatever the user is
actually using (numpy, etc) is probably imported elsewhere anyway.
(though maybe including numpy would make some sense...)

I hope this helps others in the future in any case.

-Chris








On Fri, Apr 12, 2013 at 1:47 PM, Chris Barker - NOAA Federal
<chris.barker at noaa.gov> wrote:
> OK,
>
> I've run py2app with --xref. I've enclosed the html output.
>
> Again, this app uses:
>
>> wxPython
>> numpy
>> matplotlib
>
> (and a few other stdlib packages...)
>
> I've learned a few things from this.
>
> 1) this is odd:
>   right near the top, I see:
>      prescript.py
>      imports: Image
>   that's the prescript for the PIL recipe -- I"m not using PIL, it
> seems it's runnign nthe recipe, and using what the recipe imported --
> not good.
>
>
> 2) do I need all of Carbon?
> Carbon
> imports: warnings
> imported by: Carbon.AE Carbon.Appearance Carbon.AppleEvents
> Carbon.CarbonEvents Carbon.ControlAccessor Carbon.Controls Carbon.Ctl
> Carbon.Dialogs Carbon.Dlg Carbon.Dragconst Carbon.Events Carbon.Evt
> Carbon.File Carbon.Files Carbon.Menu Carbon.Qd Carbon.QuickDraw
> Carbon.Res Carbon.TextEdit Carbon.Win Carbon.Windows EasyDialogs
> aepack aetools macostools macresource plistlib
>
> I'm guessing py2ap uses plistlib, or something...
>
> 3) Matplotlib has multipel back-ends -- that's why I'm getting TK
> stuff (and from there, Carbon?):
>    FileDialog
>        imports: Dialog Tkinter fnmatch os
>    imported by: matplotlib.backends.backend_tkagg
>
> An idea how to tweak the MPL recipe to only pull in the backend we
> need? is there a way to pass options to he recipes?
>
> 4) Ipython is getting pulled in my Matplotlib too:
>
> IPython
> imports:
> ....
> IPython.zmq matplotlib.sphinxext.ipython_directive
>
> which explains the zmq.so
>
> ( and a lot of other stuff -- iPython pulls in a lot )
>
> 5) It looks like Image is getting pulled in a couple places:
> ...
>  docutils.parsers.rst.directives.images docutils.writers.html4css1
> prescript.py scipy.misc.pilutil
>
> docutils, prescript, and scipy (not sure why scipy is pulled in yet, I
> removed that dependency...)
>
> 6)OpenGL
> imported by: IPython.lib.inputhookglut ....
>
> so that's getting pulled in by IPython, which is pulled in by MPL... ( I think )
> (wow! OPenGL sure has a lot of modules!)
>
> 7) bsddb seems to be recusively importing itself...
>
> bsddb
> imports: UserDict _bsddb bsddb.dbutils collections os warnings weakref
> imported by: bsddb.db bsddb.dbutils dbhash
>
> bsddb.db
> imports: _bsddb bsddb
> imported by: bsddb.dbutils
>
> bsddb.dbutils
> imports: bsddb bsddb.db time
> imported by: bsddb
>
> ....
>
> OK, I'm getting bored. A lot of this is really caused by Matplotlib --
> which make some sense, it's been designed to be a developers tool (or
> at least to be used interactively), with all sorts of options,
> determined at run-time.
>
> Is there a way to turn off a recipe other than removing ot from my
> py2app install?
>
> This is making me think that the MPL recipe should pull in the MPL
> package, but not scan it for dependencies...
>
> Still not sure about PIL -- but I wouldn't be surprised if MPL is
> involved somehow!
>
> -Chris
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Pythonmac-SIG mailing list