Thursday, 26 June 2008

A new Python library

I'm putting the finishing touches on a new, open source, network address library for Python. It is (somewhat un-imaginatively) called netaddr and will be released under the BSD license.

Perl and Ruby do it better

About 3 months ago, I became frustrated with the lack of robust, quality Python code for doing various kinds of network address manipulations. What I needed was the Pythonic equivalent of what Perl and Ruby have had for years. I sadly, failed to find anything that entirely lived up to my expectations.

"If you are going to re-invent the wheel, at least try and invent a better one." - Larry Wall

Having decided to take up Larry's sage advice the overall goal was to reddress this imbalance by releasing my own library.

A Pythonic solution

Early on, I decided not to look too closely at the implementation or interfaces in other languages. I believed that doing so would have a detrimental effect on my code, diluting the elusive Pythonic flavour being sought.

This meant a not unreasonable amount of extra time and effort being spent reading RFCs and IEEE standards (zzzzzzzzzzzzz) to get to the source of what should be provided by a network address library, rather than picking up on things 3rd hand from others. I also spent a decent amount of time researching as many libraries as I could get my hands on (in all 3 languages) to see what worked and what didn't.


Thankfully, the effort has proven a very worthwhile experience. Python is a great language for implementing a lot of the ideas I've had.

My Python skills have benefitted a great deal and I've learnt a lot about network addressing too (IPv6 in particular). It'll certainly improve the overall quality and effectiveness of my current and future projects. If it ends up benefitting other members of the Python community as well, that would be a big bonus. Hopefully it will give systems administrators and developers using Python a boost and end up being appreciated by more than just this party of one!

So, where too next?

In my next post, I'll be providing details on where you can get your hands on netaddr along with examples showing you how to put it through its paces.