first week working on distutils2 ################################# :date: 2010-06-04 :category: tech As I've been working on `Distutils2 `_ during the past week, taking part of the `GSOC `_ program, here is a short summary of what I've done so far. As my courses are not over yet, I've not worked as much as I wanted, and this will continues until the end of June. My main tasks are about making installation and uninstallation commands, to have a simple way to install distributions via `Distutils2 `_. To do this, we need to rely on informations provided by the Python Package Index (`PyPI `_), and there is at least two ways to retreive informations from here: XML-RPC and the "simple" API. So, I've been working on porting some `Distribute `_ related stuff to `Distutils2 `_, cutting off all non distutils' things, as we do not want to depend from Distribute's internals. My main work has been about reading the whole code, writing tests about this and making those tests possible. In fact, there was a need of a pypi mocked server, and, after reading and introducing myself to the distutils behaviors and code, I've taken some time to improve the work `Konrad `_ makes about this mock. A PyPI Server mock ~~~~~~~~~~~~~~~~~~ The mock is embeded in a thread, to make it available during the tests, in a non blocking way. We first used `WSGI `_ and `wsgiref `_ in order control what to serve, and to log the requests made to the server, but finally realised that `wsgiref `_ is not python 2.4 compatible (and we *need* to be python 2.4 compatible in Distutils2). So, we switched to `BaseHTTPServer `_ and `SimpleHTTPServer `_, and updated our tests accordingly. It's been an opportunity to realize that `WSGI `_ has been a great step forward for making HTTP servers, and expose a really simplest way to discuss with HTTP ! You can find `the modifications I made `_, and the `related docs `_ about this on `my bitbucket distutils2 clone `_. The PyPI Simple API ~~~~~~~~~~~~~~~~~~~ So, back to the main problematic: make a python library to access and request information stored on PyPI, via the simple API. As I said, I've just grabbed the work made from `Distribute `_, and played a bit with, in order to view what are the different use cases, and started to write the related tests. The work to come ~~~~~~~~~~~~~~~~ So, once all use cases covered with tests, I'll rewrite a bit the grabbed code, and do some software design work (to not expose all things as privates methods, have a clear API, and other things like this), then update the tests accordingly and write a documentation to make this clear. Next step is to a little client, as I've `already started here `_ I'll take you updated !