Tuesday, April 3, 2007

SleekXMPP

As a self-taught, professional programmer, I have a few habits that many more formally educated peers of mine do not. One of those habits is to apply knowledge I've learned to "pet projects." Every time I learn a new technique or come up with a new idea, I tend to apply them to one of my pet projects, often requiring a full rewrite. Naturally, I see no end in sight as far as being able to improve upon my skills, however, this time I think that I've arrived somewhere.

SleekXMPP is an XMPP library for Python. Why have I written my own when there are at least 2 others out there? Well, the first write was for a company that I worked for, and subsequent rewrites have simply been out of obsession with Jabber/XMPP. Who knows, maybe I can even use my knowledge and libraries to make money. I have purposely avoided even looking at the code of other Python XMPP implementations in order to maintain solid copyright.

The idea is that the Jabber/XMPP community could use this to test new XEPs (XMPP Extension Protocol) very, very quickly and easily. In fact, my goal is to implement every draft XEP in existence as plugins. This ensures that I write my code in a very extensible fashion, making it easy to extend the class in any way. I am writing the core RFC's as part of the main classes, and XEPs as plugins.

Beyond protocol testing, what am I trying to accomplish? Once I hit version 0.1 (not quite there yet), I will begin working on a bot framework. The bot framework will use the SleekXMPP lib, and in it's own right, be extensible. Bot behaviors will be configurable and extended with plugins like Thinkbot, Edgar, Mapbot, etc. Kevin Smith, of Psi fame, has promised to write a plugin for eggdrop scripts. Ideally, this framework will enable people who are not programmers to customize and run a bot. Maybe there'll be some optional GUI plugins to boot. In a related train of thought, why have I not seen more bots take advantage of data forms?

Here is some output from what I've been working on so far:

fritzy@peabody:~/dev/sleekxmpp$ ./example.py -d -c myconfig.xml
INFO Loading config file: myconfig.xml
INFO Logging in as [address-removed]@gmail.com/sleekxmpp_
DEBUG Loaded Plugin (XEP-0030) Service Discovery
DEBUG Loaded Plugin (XEP-0076) Malicious Stanzas
DEBUG Loaded Plugin (XEP-0078) Non-SASL Authentication
DEBUG Loaded Plugin (XEP-0092) Software Version
DEBUG Connecting via client method to talk.google.com:5222
DEBUG Starting TLS
DEBUG Starting SASL Auth
DEBUG Requesting resource: sleekxmpp_
INFO Node set to: [address-removed]@gmail.com/sleekxmpp_A4E39FDC
DEBUG Established Session


Some of the astute amongst you may notice that I've implemented XEP-0076 as a plugin, following right behind Psi.

Before an 0.1 release, I would like to add a well thought through plugin for XEP-0004 (Data Forms) as well as solidify some of my naming scheme for class variables and methods a little better. I should be there by this weekend. After that I will start reviewing patches and hopefully receiving contributions in the form of additional plugins. Keep in mind that a plugin does not have to be a XEP.

Feel free to check out the code using subversion at svn://netflint.net/sleekxmpp . Any feedback would be welcome.

8 comments:

Andrew said...

Would you consider releasing SleekXMPP under a different license than the GPL? XMPPpy (http://xmpppy.sourceforge.net/) is GPL, PyXMPP (http://pyxmpp.jajcus.net/) is LPGL, as is jabberpy (http://jabberpy.sourceforge.net/, and quite dead).

Releasing libraries under the GPL realy limits their use. Even the LPGL libraries can be dicey for use in some projects. Releasing SleekXMPP under a non-GPL license could do great things for the widespread use of both SleekXMPP and XMPP use in python.

Fritzy said...

I'm definitely open to the idea of other licenses. I haven't made an official release yet, and I may release a future version under a different license. I'm simply the most familiar with GPL, so that's where it sits for now. I can likely be convinced to use another license.

Andrew said...

Great! The MIT and BSD licenses work pretty well. A python library like yours that implements the XEPs in modules, has a lot of built-in documentation for use. I think a project like that has a lot of use for XMPP compliancy tests.

Petteri said...

Heheh, where do all these exploiters come from. Seem quite selfish to ask SleekXMPP to licensed under MIT or BSD license just so that you can wrap up the library in your jabber client and laught all the way to bank.

SMD said...

Folks authoring code like to release code licensed under the GPL because they would like to obligate the user to give back changes to the authors code in products they release, as well as the entire source code to the product using the authors code.

Folks using open source code in their commercial products like to use code released under BSD or MIT licenses so that they have no obligation to give anything they've used back to the community that generated it. Not the code they borrowed from the author, nor the rest of their application need be released. In fact, the MIT license doesn't even have to credit the author, except for the inclusion of a copyright message (which, by the way, is not required, by the license itself, to be visible to the end-user).

Using a BSD or MIT license almost certainly will spread adoption of your library beyond the use of the GPL. However, you may never know. You may get mysterious support emails from folks using your code in a "pet project" that is "not quite ready" and thusly has not been released yet. I know someone who provided close to 20 hours worth of free support to someone using his MIT licensed module, only to find out later on that all he got out of it was his copyright notice embedded at the end of some really long click-through EULA.

As a compromise, if you wish to receive changes to your released code, but don't want to force adopters to release the code to their whole app, just use the Lesser GPL (LGPL).

Perhaps Andrew is interested in the fact that you've scrupulously avoided looking at other implementations, have cooked up yours from scratch, proclaim a clean modular architecture, and are willing to relicense in such a way that a project he's involved in might profit from your work. This is not a accusation, but an interesting thought-experiment. What other possible reason would there be for the LGPL to be "dicey", unless one did not want to give back changes to the author? Patent protection (which you don't get from MIT/BSD licenses either)?

It's not your problem that another enterprise that wants to use your code may have an idiot legal department that doesn't really understand software licensing.

Consider the importance of *your* effort and *your* work. Besides, his examples are of dead projects... why should you care that those projects are dead?

aconbere said...

I haven't been able to get some roster management features working with sleekxmpp, in particular I'm trying to add and remove contacts from my roster.

Is there a way to do this that I'm missing? Or is this something I should hack on an submit a patch back?

Andrew said...

All,

I do really understand licenses. When I was looking for python xmpp libraries to use at work, I needed one where I could add in some proprietary pieces I was not allowed to release.

Basically, the choices were pyxmpp (LGPL) and xmpppy (GPL). (jabberpy was abandoned, and still needs a complete rewrite.) I was more than happy to submit core changes back to the project. I was not willing to "free" everything I ever did to the project.

I look at it like the Baen free library, where you can download certain books absolutely for free. The issue book authors have is that people haven't read them, and spending money + time is the hurdle. Software projects are similar, I propose. An LGPL project allows for that. GPL does not.

Different licenses are good for different things. For libraries, I really dislike the GPL. I argue that that is why the jabber XMPP libraries aren't as popular as others.

But, it's not my project. Just my $0.02.

pankaj said...

Hi, i tried to checkout your code but it displays following error

Command: Checkout from svn://netflint.net/sleekxmpp, revision HEAD, Fully recursive, Externals included
Error: Unknown hostname 'netflint.net'
Finished!: