Re: [Twisted-Python] zope.interface?

2010-03-08 Thread Sven-Erik Tiberg
It's even more "challanging" ZOPE vers. uses a modified zope.interface lib.
Not a great idea to run both plone and python.twisted... On the same windows 
mashine, thoung it could eb a challange but better save time to the main 
project goal.

BG
Sven-Erik 

-Original Message-
From: twisted-python-boun...@twistedmatrix.com 
[mailto:twisted-python-boun...@twistedmatrix.com] On Behalf Of Itamar 
Turner-Trauring
Sent: den 8 mars 2010 15:48
To: Twisted general discussion
Subject: Re: [Twisted-Python] zope.interface?

On Mon, 2010-03-08 at 15:36 +0100, Sven-Erik Tiberg wrote:
> Thanks
> 
> Only to clearify:
> Has zope.interface any depedencies/connection with the Zope web 
> application server primarily written in the Python programming 
> language  ( http://www.zope.org/WhatIsZope ).
> 
> Note: zope "web application server" uses ZODB ( 
> http://docs.zope.org/zodb/ ) as data base.
> And plone (http://plone.org ) a CMS system are based on zope.

They are connected, yes. zope.interface is maintained by Zope people, but it's 
only a small subset of their code:

1. Twisted depends on zope.interface
2. Zope depends on zope.interface

But

3. Twisted does *not* depend on Zope, ZODB, Plone, etc..

You can pretend it's just called "interface" if that helps :)


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface?

2010-03-08 Thread Itamar Turner-Trauring
On Mon, 2010-03-08 at 15:36 +0100, Sven-Erik Tiberg wrote:
> Thanks
> 
> Only to clearify:
> Has zope.interface any depedencies/connection with the Zope web
> application server primarily written in the Python programming
> language  ( http://www.zope.org/WhatIsZope ). 
> 
> Note: zope "web application server" uses ZODB
> ( http://docs.zope.org/zodb/ ) as data base. 
> And plone (http://plone.org ) a CMS system are based on zope.

They are connected, yes. zope.interface is maintained by Zope people,
but it's only a small subset of their code:

1. Twisted depends on zope.interface
2. Zope depends on zope.interface

But

3. Twisted does *not* depend on Zope, ZODB, Plone, etc..

You can pretend it's just called "interface" if that helps :)


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface?

2010-03-08 Thread Sven-Erik Tiberg
Thanks

Only to clearify:
Has zope.interface any depedencies/connection with the Zope web application 
server primarily written in the Python programming language  ( 
http://www.zope.org/WhatIsZope ). 

Note: zope "web application server" uses ZODB ( http://docs.zope.org/zodb/ ) as 
data base. 
And plone (http://plone.org ) a CMS system are based on zope.

More notes on http://wbsp.arb.ltu.se/3DNetwork/

BG
Sven-Erik Tiberg



-Original Message-
From: twisted-python-boun...@twistedmatrix.com 
[mailto:twisted-python-boun...@twistedmatrix.com] On Behalf Of Itamar 
Turner-Trauring
Sent: den 8 mars 2010 13:47
To: Twisted general discussion
Subject: Re: [Twisted-Python] zope.interface?

On Mon, 2010-03-08 at 12:55 +0100, Sven-Erik Tiberg wrote:
> Hi
>  
> Setting up ejabberd server and python.twisted clients for 
> interactive3D.
> In for example the lib...twisted.words.protocols.jabber\component.py
> there are a call to zope.interface.
>  
> Doesnt seems to be a call to the zope db-server that powers Plone 
> servers, is that correct?
> PS. having plone/zope servers running at the same server that can be 
> running xmpp___.py clients.

zope.interface is a very small library; the fact it has "zope" in the name 
doesn't mean it uses the full capabilities of a Zope server. You are correct, 
it does not use the Zope database.

You can download it separately here:
http://pypi.python.org/pypi/zope.interface#download



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface?

2010-03-08 Thread Itamar Turner-Trauring
On Mon, 2010-03-08 at 12:55 +0100, Sven-Erik Tiberg wrote:
> Hi
>  
> Setting up ejabberd server and python.twisted clients for
> interactive3D.
> In for example the lib...twisted.words.protocols.jabber\component.py
> there are a call to zope.interface.
>  
> Doesnt seems to be a call to the zope db-server that powers Plone
> servers, is that correct?
> PS. having plone/zope servers running at the same server that can be
> running xmpp___.py clients.

zope.interface is a very small library; the fact it has "zope" in the
name doesn't mean it uses the full capabilities of a Zope server. You
are correct, it does not use the Zope database.

You can download it separately here:
http://pypi.python.org/pypi/zope.interface#download



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] zope.interface?

2010-03-08 Thread Sven-Erik Tiberg
Hi

Setting up ejabberd server and python.twisted clients for interactive3D.
In for example the lib...twisted.words.protocols.jabber\component.py there are 
a call to zope.interface.

Doesnt seems to be a call to the zope db-server that powers Plone servers, is 
that correct?
PS. having plone/zope servers running at the same server that can be running 
xmpp___.py clients.

BG
Sven-Erik Tiberg
Lulea Univ of technology / Sweden

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-16 Thread Paul Thomas

On 15 Dec 2009, at 18:11, Jared Gisin wrote:

> What's wrong with writing subclasses? I've never had a case where  
> that wasn't sufficient. Instead of filling up your files with all  
> of  these empty class definitions that define the methods that  
> objects should implemmnt, why not just make the base object from  
> which all similar object inherit implement the required methods, and  
> if it's up to a subclass to provide functionality, just raise an  
> ImplementationError in the base class method and let it be a run- 
> time error. Keep it clean and simple and let Python do its work.

Wouldn't that be _more_ empty class definitions?



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-15 Thread Glyph Lefkowitz

On Dec 15, 2009, at 1:11 PM, Jared Gisin wrote:

> I completely fail to see why zope.interface is even needed. It's not Pythonic 
> at all and it contributes to unnecessary code bloat.

Oh gosh!  You're absolutely right!  I never noticed it before!  I just got out 
my Pythonic-o-meter and measured Zope Interface!  Apparently it is only 0.44 
vRossums!  (For those you familiar only with the SI units, a vRossum is 
equivalent to one Microtim per cubic meter-second).  We should totally delete 
all the interfaces in Twisted!

Wait, oops.  I mean, did you even read 
?
  There are lots of reasons to have interfaces.

> What's wrong with writing subclasses?

Lots of things in Twisted are subclasses.  twisted.internet.protocol.Protocol 
provides a helpful utility base-class for implementing 
twisted.internet.interfaces.IProtocol.  If you use them for what they're good 
for, there's nothing wrong with them.

But, as I said in my article, interfaces and classes are for different things.

As a very simple example of what's wrong with subclassing, there are times when 
having extra superclasses breaks things.  For example: let's say that you want 
to have an IProtocol implementation that uses __slots__ and doesn't have a 
__dict__.  Or, you want to do the equivalent thing in C to write a 
super-optimized IProtocol implementation.

If your documentation says "this parameter must be a Protocol", then you're 
stuck.  There's no way to enforce that or provide friendly debugging error 
messages when you *don't* provide a Protocol; you just have to invoke the 
appropriate methods and hope it works.  If you do actually subclass Protocol in 
your application, in the best case you get a class which accidentally inherits 
a __dict__, and in the worst case you get a base class layout conflict error 
and you can't even import your module.  There are also lots of ways that 
metaclasses can conflict, inheritance hierarchies can become awkward and 
confusing, etc.  This is even worse if the base class you want happens to do 
some unwanted work in its constructor.

Another use for interfaces is testing.  For example, you can use interfaces to 
write tests to make sure that your code is up-to-date with the most recent 
specifications.  Let's say that we have an interface, IFoo, that has a method, 
'bar'.  We want to add a method, 'baz', to it.  Now, applications may be 
claiming to implement IFoo already, so we need to be careful when we invoke 
'bar' as it may not be present, but the savvy implementor could use 
'verifyObject' to make sure that their MyFoo class properly implemented all the 
required methods, and IFoo.

There are some things you can kinda-sorta do with metaclasses or introspection 
to provide similar functionality, but they're highly susceptible to 
implementation details shifting around.  Metaclasses, in particular, tend to 
exacerbate the problems I mentioned above with inheritance conflicts and 
features like __slots__.

Yet another use for interfaces is adaptation.  This is very useful in 
integration systems like twisted.cred.  The interface object serves as a 
concise encapsulation of what the calling code wants to get out of cred, and 
realm implementations can return whatever.

> I've never had a case where that wasn't sufficient.

Your limited experience isn't necessarily a good argument for what Twisted 
should or shouldn't do.  There are many people for whom the 'urllib' or 
'socket' modules have always been sufficient, but that doesn't mean we're going 
to give up and go home either.

If you still don't think my reasoning is adequate, you should spend a few years 
contributing lots of really useful patches to Twisted, then bring this up again.


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-15 Thread Jared Gisin
I completely fail to see why zope.interface is even needed. It's not Pythonic 
at all and it contributes to unnecessary code bloat.

What's wrong with writing subclasses? I've never had a case where that wasn't 
sufficient. Instead of filling up your files with all of  these empty class 
definitions that define the methods that objects should implemmnt, why not just 
make the base object from which all similar object inherit implement the 
required methods, and if it's up to a subclass to provide functionality, just 
raise an ImplementationError in the base class method and let it be a run-time 
error. Keep it clean and simple and let Python do its work.

-Jared

-Original Message-
From: twisted-python-boun...@twistedmatrix.com 
[mailto:twisted-python-boun...@twistedmatrix.com] On Behalf Of Andrew Bennetts
Sent: Monday, December 14, 2009 5:21 PM
To: Twisted general discussion
Subject: Re: [Twisted-Python] zope.interface

Tim Allen wrote:
[...]
> It occurs to me that recent discussions about splitting Deferreds off
> into their own library might consider zope.interface as a model. Has it
> prospered, as separate library? Does anyone besides Zope and Twisted use
> it? I don't know, but it might be worth finding out.

I'm not sure that it has “prospered” exactly, but a Python 3 added its
Abstract Base Classes feature[1] to satisfy some (many?) of the same needs.
So in some sense the general idea has prospered, even if this particular
implementation hasn't taken over the world.

-Andrew.

[1] http://docs.python.org/dev/3.0/whatsnew/2.6.html#pep-3119

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-14 Thread Andrew Bennetts
Tim Allen wrote:
[...]
> It occurs to me that recent discussions about splitting Deferreds off
> into their own library might consider zope.interface as a model. Has it
> prospered, as separate library? Does anyone besides Zope and Twisted use
> it? I don't know, but it might be worth finding out.

I'm not sure that it has “prospered” exactly, but a Python 3 added its
Abstract Base Classes feature[1] to satisfy some (many?) of the same needs.
So in some sense the general idea has prospered, even if this particular
implementation hasn't taken over the world.

-Andrew.

[1] http://docs.python.org/dev/3.0/whatsnew/2.6.html#pep-3119

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-14 Thread David Ripton
On 2009.12.14 11:48:48 +, Phil Mayers wrote:
> Jared Gisin wrote:
> > Is there a good document that explains why zope.interface is necessary 
> > to the twisted project?
> 
> A counter-question: Is there a good document that explains why people 
> care? It's just another dependency isn't it?

Sure.  But Twisted has a very small number of dependencies (I think
Python and Zope Interface are the only ones that are absolutely
required) so it does increase the total effort to install Twisted on an
OS without a good package manager by a noticable amount.

Zope Interface is a good library, and I think the Twisted team made the
right call when they decided to use it rather than continue to maintain
their own interface library.  It's not their fault that installing
Python dependencies on some operating systems is still way harder than
it should be.

It would be great if general Python installation and packaging tools
improved to the point where one could easily install Twisted and all its
dependencies on any supported OS using PyPI, as easily as we can on
Linux or BSD using the OS package manager, or as easily as we can
install Perl packages from CPAN, or as easily as we can run Java stuff
using Java Web Start, etc.  Enough smart people care about this problem
that I'm pretty sure it'll be solved over the next couple of years.
Which is too far away to save me from having to write big nasty custom
Windows and MacOS installers for my current game, but might mean that
this is the last time I ever have to do it.

-- 
David Riptondrip...@ripton.net

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-14 Thread Phil Mayers
Tim Allen wrote:
> On Mon, Dec 14, 2009 at 11:48:48AM +, Phil Mayers wrote:
>> Jared Gisin wrote:
>>> Is there a good document that explains why zope.interface is necessary 
>>> to the twisted project?
>> A counter-question: Is there a good document that explains why people 
>> care? It's just another dependency isn't it?
> 
> Trying to remember back to when I was a Twisted newbie, I seem to
> recall a pang of dismay at seeing the word "zope", until I realised that
> zope.interface was very small and self-contained and didn't have further
> dependencies on the rest of Zope.

As someone who went through the awesomely steep learning curve for (and 
still uses) Zope, I can sort-of understand that "oh no zope" moment, but 
on the other hand, having used Zope a lot, I finally realised it's kind 
of the Unix of web frameworks ("those that don't understand Zope are 
doomed to reinvent it, poorly"). My crufty old Zope 2 installation still 
does things no other web does without extensive configuration, patching 
or work on my part.

It's sad that what is actually a fine product is detested within the new 
generation of python coders because they couldn't take the time to learn 
it, and it's even sadder to imagine uptake of a small, self-contained 
and well-tested sub-package suffers because of its name.

This is one excellent argument for putting it into the standard library, 
which I guess isn't going to happen :o(

> 
> Another possibility might be that the worry comes from people using
> systems that don't have good built-in dependency management. I don't
> know where pip/easy_install are at these days, but Debian's apt and
> Fedora's yum have numbed the painful memories of downloading some
> interesting code off the 'net and discovering yet further dependencies
> I would have to track down and install to get things working.

Yes, there do seem to be an awful lot of people who are basically too 
lazy to put actual work into getting their software environment 
functioning ;o)

In all seriousness though - people are either installing from source, or 
a package. If the former, they're going to have to "python setup.py 
install" at least once; one more time (on an easy-to-compile package 
with no dependencies of its own) is not compelling to me!

> 
> I'm not saying these are well-researched or compelling reasons, just
> speculating about what might be going on.
> 
> It occurs to me that recent discussions about splitting Deferreds off
> into their own library might consider zope.interface as a model. Has it
> prospered, as separate library? Does anyone besides Zope and Twisted use
> it? I don't know, but it might be worth finding out.

I don't *think* a lot of code uses it, which is unfortunate and 
symptomatic (IMHO) of a certain level of immaturity within the Python 
community.



"""Hey, do you know what we need? Another web framework, with its own 
template engine, ORM and plugin API! W00t! This'll show those Ruby+Rails 
folks!"""

Really? Show them what exactly?



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-14 Thread Tim Allen
On Mon, Dec 14, 2009 at 11:48:48AM +, Phil Mayers wrote:
> Jared Gisin wrote:
> > Is there a good document that explains why zope.interface is necessary 
> > to the twisted project?
> 
> A counter-question: Is there a good document that explains why people 
> care? It's just another dependency isn't it?

Trying to remember back to when I was a Twisted newbie, I seem to
recall a pang of dismay at seeing the word "zope", until I realised that
zope.interface was very small and self-contained and didn't have further
dependencies on the rest of Zope.

Another possibility might be that the worry comes from people using
systems that don't have good built-in dependency management. I don't
know where pip/easy_install are at these days, but Debian's apt and
Fedora's yum have numbed the painful memories of downloading some
interesting code off the 'net and discovering yet further dependencies
I would have to track down and install to get things working.

I'm not saying these are well-researched or compelling reasons, just
speculating about what might be going on.

It occurs to me that recent discussions about splitting Deferreds off
into their own library might consider zope.interface as a model. Has it
prospered, as separate library? Does anyone besides Zope and Twisted use
it? I don't know, but it might be worth finding out.


Tim.

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-14 Thread Phil Mayers
Jared Gisin wrote:
> Is there a good document that explains why zope.interface is necessary 
> to the twisted project?

A counter-question: Is there a good document that explains why people 
care? It's just another dependency isn't it?

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] zope.interface

2009-12-11 Thread Glyph Lefkowitz

On Dec 11, 2009, at 12:12 PM, Jared Gisin wrote:

> Is there a good document that explains why zope.interface is necessary to the 
> twisted project?

Not as such, but you may be interested in 
.

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] zope.interface

2009-12-11 Thread Jared Gisin
Is there a good document that explains why zope.interface is necessary
to the twisted project?

 

-Jared

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python