[Distutils] installing .py plugins to an alternate directory

Andrew Dalke dalke at dalkescientific.com
Sat Dec 5 00:34:11 CET 2009


On Dec 4, 2009, at 9:18 AM, kiorky wrote:
> ZopeComponentArchitecture/Entry points with an assembler like buildout for the
> later won't pollute site-packages


I tried searching for "ZopeComponentArchitecture/Entry points" but found nothing that seemed relevant. Did you mean "setuptools entry_points"?

I only know a bit about them, in the context of using TurboGears, but have not used them in my own code.

I had some concerns about them. For one, all of the plugins define out-word facing web services on our server. If the plugins can be located in arbitrary locations inside of site-packages, how does the administrator know which plugins will be activated? How does the admin enable/disable a plugin for testing or security reasons, except by changing the entire package installation?

If the admin wants to change the URL for a given service from "/spam" to "/spam_and_eggs", which is currently done as configuration data in the installed plugin, file, that is, by changing

# default service name is base on the function name. This becomes "/spam"
@simple_service("GET", "http://protocol.id/")
def spam():
  return "Spam!"

 -to-

@simple_service("GET", "http://protocol.id/", "spam_and_eggs")
def spam():
  return "Spam!"


It does not seem like changing the installed package will be so simple. It would mean searching the installed site-packages to find "spam" (instead of now, which is done with a grep of a single directory) and possibly made more difficult if the package is installed as an egg.

These are reasons I decided not to look into setuptools' entry_points as a solution to this problem.
 
				Andrew
				dalke at dalkescientific.com




More information about the Distutils-SIG mailing list