Close this search box.

New release of basketweaver and how to create your own package index for Python

Once upon a time Chris McDonough was ranting about distribution_links and how they are considered harmful and out of that came a script which enabled you to easily create your own package index for your buildout to use.

A little while later this was turned into a proper package named basketweaver by Christopher Perkins and uploaded to PyPI.

Today I released a new version of it which adds support for bz2 files (as well as adding a README and CHANGES.txt).

Installation is done via setuptools:

easy_install -U basketweaver

Why you want your own package index

Usually when using buildout without your own package index you get packages from PyPI or other sources which are not under your control. This can later lead to problems if e.g. some package is updated on one index but breaks your setup. (in case you don’t know that much about buildout, here is a screencast and here a talk from EuroPython 2008)

Thus it’s better to use your own index.

How to create your own index?

What you need for your own index is a directory full of Python packages which you e.g. can download from PyPI one package by package basis. Put all this into a directory, install basketweaver and call it like this:

makeindex *

This will go through all packages, extract the index information from it and will build an index in the same directory called index.

Now you need to point a webserver to that directory and the HTTP URL of that web server is what you need to put into your buildout:

index = http://yourserver/path_to_your_index

You can even protect your index with a password by configuring your webserver accordingly and using the syntax http://yourname:yourpw@yourserver/path_to_your_index/.

One problem might be to populate your index with all the packages you need which is tedious in case you are dealing with a lot of packages. One thing you can try though is to use the download-cache = path configuration option of buildout which will place all downloaded packages in the given directory which can then be copied over to the index.

PyPI entry of basketweaver

Teile diesen Beitrag