josip's posterous

Hello there! This summer I am taking part in Google's Summer of Code program, I will be working on the distutils2 project under the umbrella of the Python Software Foundation. Here I will post information about the progress of the project and, of course, rumblings about whatever else comes to my mind.

Test 123 $\lambda = 5$.

GSoC - Done

Yesterday was the official pencils-down date, so GSoC 2010 has finally finished. It was a very interesting and productive summer, as we added plenty of new features to distutils2. I would like to thank my mentor Michael Mulich, the fellow students and all other developers that took part in the development of distutils2 this summer, either directly or undirectly. I think that we did make some progress, and to get a better idea of what has been done you can take a look at their final reports: Mouad, Alexis, Zubin, Konrad. My task consisted of three parts (the official wiki entry)


Implement pkgutil APIs described in PEP 376

All the functionalities proposed in PEP-376 are now supported in distutils2. In addition, we also decided to add back-support to be able to read .egg distributions as well. This is turned off by default and can be turned on by setting the use_egg_info parameter to True in any of the functions. Also, a cache a has been added to seed things up in case of multiple queries for the distribution database. To get a better idea, I suggest you to take a look at the latest  documentation.

Implement a dependency-graph builder

As described in a previous post, this tool is able to create graphs from the dependency among the distributions on the system. The best introduction is the
official documentation.


Add basic PEP 376 support in Distribute

Distribute has now .dist-info read support, meaning that it can also use PEP 376-style packages completely transparent to the user.


In addition to these tasks, I also did some extra work as I finished a bit early.

First, I added distutils2 support to extensions. The use is very simple, as can be seen from this adapted snippet from the actual documentation

# The procedure is similiar to the one for `distutils`,
# just the name of the module has to be changed,
# i.e. the `setup.py` file will look like::      

from distutils2.core import setup
from myapp import plugins

# registers the plugins
setup(name='myapp', version='1.0',
         packages=['myapp'])

# What is different, is where the `PLUGINS` file with all
# the entry points is located. In this case, it is placed in
# the `.dist-info` directory of the distribution which is created
# in accordance with :pep:`376`.

Also, and more importantly (at least to me), I wrote the install_distinfo command that creates the .dist-info directory for the distribution, and got rid of all
the egg-relted code. To use it you don't have to do anything, just run the install command and then it in turn calls install_distinfo. To get a better feel, an example installation looks like this

(josip@laptop) example % sudo python setup.py install
running install
running build
running build_py
running install_lib
running install_distinfo
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info/METADATA
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info/INSTALLER
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info/REQUESTED
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info/RECORD
Creating /usr/lib/python2.6/site-packages/Hello_World-0.1.dist-info/PLUGINS

Week #3

Dear all,

This week, I have worked on making pkgutil and depgraph complete for merging. What has been done is the following:

  • I have finished the documentation for both modules. In addition to the API docs, a narrative was added with some examples
  • Wrote a test suite for depgraph
  • Integrated the test cases for pkgutil from Python 2.7's trunk


Next, I will optimise pkgutil by using caching, and after that read/write support shall be added to distribute. The code is readily available from my repository (in case you want to review it) and it has been already merged upstream by Tarek.

Week #2

The previous week I missed a few days as something unforeseen came up, so I will do some extra work during the weekend. I was finishing my work on pkgutil API and the dependency graph module. The code has been committed to my repository. The back support for eggs has been completed and the requirements are parsed as well. This has been done in a bit tricky way to enable to use to use the EggInfoDistribution instances transparently where a Distribution instance is expected. What is done, is that for for every non-extra requirement in requires.txt, we add a corresponding Requires-Dist field to the metadata. Also, a Provides-Dist field is added with the contents from the Name: and Version: fields. And finally, I can say that we have some interesting graphs being generated. A picture has been uploaded here. I am also open to any ideas for the depgraph API, if you think that we can extend it with so me useful functions. Until the 12 this month I will complete the documentation for these two modules. With Michael we have created a calendar with deadlines of the tasks that I will have to complete, and I will post a link here once I find out how to come up with a globally available link. The next steps are to document these modules and to finally finish the document with proposed changes to the PEPs so we can overcome some of the problems that I briefly brought up in the weekly meetings on #distutils.

Week #1

GSoC has officially started as of this week, and after finishing my last exam I have started working on my tasks as described in the wiki. The pkgutil API defined in PEP-376 is now completely implemented, together with a test suite. As Tarek has suggested (after discussion with Ian Bicking) we have also added support for distributions that provide an .egg-info directory/file instead of a .dist-info one. The API is compatible with the one in PEP-376, just some functions have an extra parameter that enables the inclusion of .egg-info distributions as well. You can see the actual implementation in my bitbucket repository. I have also started working on a module called distutils2.depgraph that creates a dependency graph from the installed distributions on the system. It is also possible to generated dot output, and here is an example

Media_httpiimgurcomkb_gkidh

After testing the code with all distributions on my system, I realised that almost none of them use Requires(-Dist) and Provides(-Dist), but rather install_requires. So, as we discussed with Tarek, we are adding support for reading requires.txt as well. So, what is next on the roadmap

  • add support for requires.txt to EggInfoDistribution
  • add support for metadata from zipped eggs
  • add basic PEP 376 support in Distribute and pip