Using parts of nwu in your project
As I promised I am writing about nwu again. But instead of reporting on recent development efforts I would rather like to point something else out today: The nwu.common Python module contains code which can be used stand-alone in your applications. Some of the functions the module provides could come in handy, so I thought it was a good idea to let you know.
This article is going to explain the stand-alone nwu.common.* modules and their function.
nwu.common.SecureXMLRPC
I would like to start out introducing my "baby": SecureXMLRPC. As the name suggests it provides support for XML-RPC over https. You might think "but that's present in Python's SimpleXMLRPCServer and xmlrpclib already" and you are right about that. However, the Python implementation uses OpenSSL, whilst SecureXMLRPC provides both a server and client implementation using GnuTLS. Even though the OpenSSL version works perfectly fine you cannot link it to GPL-licensed code due to the OpenSSL license being incompatible to the GPL.
Furthermore SecureXMLRPC supports compression of the XML-RPC payload and as of today is aware of multi-threading.
nwu.common.config
The config module provides a single class, "Config". It basically is a slightly improved version of Python's SafeConfigParser class and allows passing a "default value" argument to its get() method which is returned in case the setting is not present in the config.
nwu.common.app
This is a simple application framework. It makes use of "nwu.common.config" for reading the config file. However, its main feature is a simple-to-use command-line parser, which parses not only arguments from the command-line (such as --do-something, -d or --configfile=filename), but also supports "commands" as they can be found in several applications, such as aptitude. This way it is easy to not only create top-level commands (like "aptitude search <package name>"), but also nested command structures (like "program computer get <computer name>", "program computer list", etc.).
nwu.common.certtool
The certtool module is a wrapper around GnuTLS' certtool application. It allows you to create private keys, certificate authorities, sign certificates, created certificate-signing-requests (CSRs) and sign such.
However, please note that it currently does not implement the full functionality certtool provides but rather only the pieces nwu needs.
nwu.common.aptmethod
nwu.common.aptmethod simplifies implementation of an APT transport/method in Python. It takes care of all communication done with apt itself and thus gives you the opportunity to implement a new method in a simple way.
nwu.common.apt
Finally there is also the apt module. This module currently contains code to parse APT Packages files.
nwu.common.scheduler
One of the latest additions to the common module. It provides a way of scheduling tasks for execution at a certain date/time and executing a task in a given interval.