ANN: visage (interfaces)

I just pushed this up to pypi/github, and I hoped to acquire some c.l.py opinions. It's experimental at this point, and might get scrapped.

visage is a loosely coupled interface registry. weakrefs make it cake to implement.

Basically, zope.interface, but where the interfaces are referenced by an identifier instead of the defining Interface class. Also, ABC registration is performed when the Interface becomes available so that isinstance/issubclass checks can be performed on Implementation instances/classes.

FWICT, pyprotocols allows for something like this, but while introducing many "interesting concepts". (;

Currently, visage has no concept of adaption, but I'm suspecting that it could be built *on top* of the existing foundation.

Personally, I'd prefer to reference interfaces by an identifier. Notably, the idea of having to pull in a dependency in order to perform local tests that have no need for the formal Interface class is reason enough for me to use something like this instead of the existing solutions. Sure, to each their own.?

I've been working with Plone for the past year and have become a big fan of interfaces. I must admit I _do_ like zope.interface's adaptation, but your's looks lighter in a way that could be handy for a side project, so I may have some more concrete feedback soon :)

I pushed another version with support for IID references, so you can refer to implementations in annotations. The ultimate point of this is to give registry queries the ability to check for implementations with particular features:

Imp.meth making a statement that a 'bar' implementation will be returned.

That is, consider code that is not aware of the modules that "Imp" is stored in but wants a 'foo' implementation whose "meth" method returns a 'bar' instance. Registry queries pave the way for supporting IID based implementation resolution. There is also the potential that registry information could be extracted on package installation for the purpose of an implementation index. Implementations could be imported on demand by modules that have no knowledge of the implementation. -- http://mail.python.org/mailman/listinfo/python-list