[Pythonmac-SIG] [py2app] packaging an egg using pkg_resources
Chris Barker
Chris.Barker at noaa.gov
Thu Oct 20 17:38:38 CEST 2011
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.
> 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
More information about the Pythonmac-SIG
mailing list