[Pythonmac-SIG] py2app, eggs and entry points

Ronald Oussoren ronaldoussoren at mac.com
Sat Mar 31 16:09:51 CEST 2007

On 29 Mar, 2007, at 14:47, Nathan R. Yergler wrote:

> I have an application that I'd like to package using py2app, but I'm
> getting a little stuck with things.  I *think* my problem is that my
> setup.py is fully setuptools-ized and my application script lives
> inside my package.  Here's the call I make to setup():
> setup(name='cclookup',
>       version='2.0',
>       url='http://wiki.creativecommons.org/CcLookup',
>       author='Nathan R. Yergler',
>       author_email='nathan at creativecommons.org',
>       packages = ['cclookup', 'tagger', 'eyeD3'],
>       setup_requires = setup_requirements,
>       install_requires = ['setuptools',
>                           'rdflib==2.3.3',
>                           'ccrdf>=0.6a4',
>                           'cctagutils>=0.5a1',
>                           'rdfadict',
>                          ],
>       include_package_data = True,
>       zip_safe = False,
>       entry_points = {
>         'console_scripts':['cclookup = cclookup:main'],
>       },
>       app=['cclookup/app.py'],
>       options={ "py2exe": {"packages": ["encodings", 'rdflib']},
>                 "py2app": {"argv_emulation": True,
>                            "iconfile": os.path.join('cclookup',
> 'resources', 'cc.icns')
>                            }
>                 },
>       )
> When I try to run this with py2app, it crashes into pdb complaining
> that it can't locate pkg_resources.  Running the super-simplified
> version of setup.py generated by py2applet builds correctly, but has
> the following problems:
> * dependencies aren't included (I'm not sure if py2app actually
> attempts to scan for them like py2exe or not, so this may not be
> py2app's fault in the least)

Py2app scans for import statements, but cannot look inside zipfiles  
at the moment.

> * app.py is included by itself, as opposed to as part of the package.

That's by design. Teaching py2app to do the same as setuptools does  
for console_script entrypoints shouldn't be too hard, but nobody has  
gotten around to doing this yet.

> I think that ideally I'd be able to specify my application as a
> gui_scripts entry point to setup(), and have it play nicely with the
> eggs specified in install_requires.  I saw the docs mentioned that a
> future version would use eggs (I think it was in reference to
> recipes), and I was wondering what the status of that effort is.

AFAIK nobody is working on that. You're problems are caused by lack  
of 'egg' support in py2app, the current version of py2app doesn't  
look at entry points or other setuptools specific data other than the  
requires lines.

I have a patch that teaches py2app to look inside zipfiles, I'll  
merge that when I have some time to do so. Full setuptools support  
should be possible as well, I haven't looked seriously at this yet  
though. Patches would be greatly appriciated :-)


More information about the Pythonmac-SIG mailing list