ANN: visage (interfaces)

Discussion in 'Python' started by jwp, Jul 30, 2012.

  1. jwp

    jwp Guest

    Hi,

    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 isperformed 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.?

    What's c.l.py's perspective on managing interfaces and implementations?

    **** it, ship it? =)
     
    jwp, Jul 30, 2012
    #1
    1. Advertising

  2. jwp

    jwp Guest

    On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote:
    > I just pushed this up to pypi/github, and I hoped to acquire some c.l.py opinions.


    http://github.com/jwp/py-visage
     
    jwp, Jul 30, 2012
    #2
    1. Advertising

  3. jwp

    alex23 Guest

    On Jul 30, 3:18 pm, jwp <> wrote:
    > What's c.l.py's perspective on managing interfaces and implementations?


    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 :)

    BTW I think if you rename the ReStructured Text docs to .rst github
    will automatically render them.
     
    alex23, Jul 31, 2012
    #3
  4. jwp

    jwp Guest

    On Monday, July 30, 2012 6:09:10 PM UTC-7, alex23 wrote:
    > a side project, so I may have some more concrete feedback soon :)


    =)

    > BTW I think if you rename the ReStructured Text docs to .rst github
    >
    > will automatically render them.


    Did not know that. Gonna go do a lot of git mv's now.

    Thanks.
     
    jwp, Jul 31, 2012
    #4
  5. On Mon, 30 Jul 2012 18:41:19 -0700, jwp wrote:

    >> BTW I think if you rename the ReStructured Text docs to .rst github
    >> will automatically render them.

    >
    > Did not know that. Gonna go do a lot of git mv's now.


    Do *one* and see if github actually does render it. Then do the rest.


    --
    Steven
     
    Steven D'Aprano, Jul 31, 2012
    #5
  6. jwp

    jwp Guest

    On Monday, July 30, 2012 7:09:03 PM UTC-7, Steven D'Aprano wrote:
    > Do *one* and see if github actually does render it. Then do the rest.


    Did it for one project. It does render it. =)

    Naturally, sphinx autodoc links don't work. =( Come-on github, use dat fundin'
     
    jwp, Jul 31, 2012
    #6
  7. jwp

    jwp Guest

    On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote:
    > What's c.l.py's perspective on managing interfaces and implementations?


    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:

    @visage.lib.implementation('foo')
    class Imp(object):
    def meth(self) -> visage.lib.reference('bar'):
    ...

    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 couldbe 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.
     
    jwp, Aug 13, 2012
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shade
    Replies:
    1
    Views:
    1,683
  2. William F. Robertson, Jr.

    C# interfaces

    William F. Robertson, Jr., Jul 2, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    472
    [Gauthier]
    Jul 3, 2003
  3. Ollie
    Replies:
    0
    Views:
    374
    Ollie
    Sep 9, 2003
  4. Kyle Fitzgerald

    Using Interfaces to control IDE property window

    Kyle Fitzgerald, Nov 4, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    320
    Kyle Fitzgerald
    Nov 4, 2003
  5. Oney
    Replies:
    1
    Views:
    3,222
    =?Utf-8?B?aWdvcms=?=
    Sep 24, 2004
Loading...

Share This Page