
On Thu, Dec 3, 2009 at 1:06 AM, Andrew Dalke <dalke@dalkescientific.com> wrote:
Hi all,
I'm working with the Akara project. It contains a web server. The server loads extensions from a special directory (let's say "$AKARA" for now). An extension can register handlers for URLs. An example extension might look like:
installs to $AKARA/spam_extension.py (note: only .py files are supported; not even .pyc files) ========================= from akara.services import simple_service
import my_spam # This is part of the distribution, and gets put in site-packages
@simple_service("GET", "http://vikings.protocol.id/") def vikings(say=my_spam.DEFAULT_TEXT): return my_spam.vikings(say) =========================
We want people to be able to distribute Akara plugins and install via setup.py. Ideally I would like to say:
from distutils.core import setup from akara.distutils ... I'm not sure what here ...
setup(name="Spam services", package="my_spam", akara_extensions=["spam_extension.py"] )
To clarify, the development/distribution package looks like: $PACKAGE/setup.py $PACKAGE/README $PACKAGE/spam_extensions.py $PACKAGE/my_spam/__init__.py $PACKAGE/my_spam/dramatis_personae.py $PACKAGE/my_spam/cafe.py
and $PACKAGE/spam_extensions.py goes to $AKARA/spam_extensions.py while $PACKAGE/my_spam is copied to site-packages.
The installation does not need to byte-compile spam_extension.py.
It should also include spam_extension.py in any distribution that it makes.
I looked through the documentation and searched for existing examples, but found nothing which does this. The plugins I found used entry_points, and that's an architecture change which I don't think is appropriate for us.
Suggestions?
What about having an explicit configuration file in Akara for plugins, where you just add extensions, exactly like mercurial does: [extensions] foo = package.spam_extension bar = spam_extension2 where "package.spam_extension" and "spam_extension2" are modules Akara would simply __import__() Meaning a plugin will be a normal project that gets installed, and then configured to be used in Akara. Tarek