[Pythonmac-SIG] [py2app] packaging an egg using pkg_resources

carbncl carbncl at gmail.com
Thu Oct 20 19:17:48 CEST 2011


Le 20 oct. 2011 à 17:38, Chris Barker a écrit :

> On 10/20/2011 2:35 AM, Ronald Oussoren wrote:
>>>  * py2app is not designed to use eggs
>> 
>> That's corrrect. Py2app currently does not copy egg metadata into the
>> application bundle.
>> 
>>>  * pkg_resources requires a distribution format like eggs to have the
>>>    required metadata to introspect a package.
>> 
>> That's correct as well.
>> 
>>> 
>>> Does this assumptions are true? > Does that means I have to purge code
>>> from pkg_resources calls?
>>> Any good suggestion / recommended implementation is welcome.
>> 
>> The easiest solutions are to either remove pkg_resources calls, or add
>> custom pkg_resources.py file that
>> loads the resource data without using setuptools metadata.
> 
> actually, even easier is to copy the full eggs into your app bundle by hand (by hand I mean code in your setup.py) -- a bit ugly, but it works.

I thought that I had already tried this workaround w/o any success...
...Just tried it again to make sure... And that worked?!

Thanks a lot Chris for pointing this to me, how can I have missed this...
And ofc, thanks Ronald for your work and for the quick reply.

>> The "proper" solution is to teach py2app how to copy eggs with their
>> metadata and resources into the
>> application bundle.
> 
> That would be nice, but I don't know that it's really the "best" solution.
> 
> I've dealt with this for an app that was heavily dependent on setuptools features like pkg_resources, and I think setuptools is really pretty ugly, at least when you want to use things like py2app and friends.
> 
> The assumption that you're packages are fully installed as part of a nice big python install is really built in, so the only solution is to copy huge chunks of stuff, much of which you don't need, into your app bundle -- whether py2app does this automatically, or you do it in your scripts, it's still a lot of extra stuff.
> 
> Personally, I like setuptools for install time stuff, but not so much for run time stuff -- if you can avoid run time calls to setuptolls, I would.
> 
> AS for resources, personally I like to use python files for data -- and then "import" to get it - this makes for nice, clean integeration with py2app, etc.
> 
> -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
> _______________________________________________
> 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



More information about the Pythonmac-SIG mailing list