Search code examples
pythongoogle-app-enginesetuptoolspkg-resources

How can I manually register distributions with pkg_resources?


I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine.

There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of pkg_resources installed and working as well.

The only problem is getting the package actually registered with pkg_resources so when it calls iter_entry_points it can find the appropriate plugins.

What methods do I need to call to register modules on sys.path with all the appropriate metadata, and how do I figure out what that metadata needs to be?


Solution

  • Create a setup.py for the package just as you would normally, and then use "setup.py sdist --formats=zip" to build your source zip. The built source zip will include an .egg-info metadata directory, which will then be findable by pkg_resources. Alternately, you can use bdist_egg for all your packages.