This page is about development of Python Package Index (formerly known as Cheeseshop):

Developing the Package Index


Currently, as of 2013-11-11, PyPI is undergoing a complete rewrite from scratch, and as a result much of the information on this page is not actual. You can see preview of the new site at:

The development moved from Mercurial (Python) to Git (C, shell). License changed from BSD-3 to Apache 2.0. Project code named 'warehouse' can be downloaded from:

Previous PyPI version

"previous" version of PyPI is the code that was running on from ... till the end of 2013. It was originally written by ... and was running on ... . The information below should help you get around the code.

PyPI architecture and endpoints

PyPI is a WSGI application that can be executed standalone using python pypi.wsgi command if all requirements are met. pypi.wsgi contains usual WSGI wrapper code and delegates request processing to method from This method just opens DB and handles exceptions, actual request processing is done in WebUI.inner_run(). This method analyzes URL endpoint and executes appropriate handler. As of 2011-04, the rules to match endpoints to handlers are the following:



dump all package names on single html page



dump all links for a package in html list



save as above, but signed by server



display static page with a list of mirrors



display current server time


XML-RPC requests are detected by CONTENT_TYPE=text/xml variable in CGI environment and processed by rpc.RequestHandler().__call__(). List of XML-RPC "endpoints" is available on PyPIXmlRpc page.

Testing Your Stuff Against PyPI

If you need to test stuff against PyPI (registration, uploading, API activities) then please use the alternative server "".

TO-DO list

Something that's been requested, but needs much more thought and analysis to see whether it causes any problems: the ability to treat project names and versions as case-insensitive, while removing extraneous characters (as in pkg_resources.safe_name()) for purposes both of searching and determining name uniqueness when registering.


Not Going TO-DO


Development Environment Hints

WARNING: Most of the information in here are out of date, see the instruction on the PyPI-legacy GitHub repository for more information, and most likely ask the developers for hints before trying to work on PyPI locally on your own !

PyPI uses postgresql 8.3 as a database, with a roll it yourself web framework based on different python modules. It uses apache2 as the web server.

It can run using wsgi, cgi, fcgi and mod_python.

Before restoring database, "pypi" role must exists:

  createuser pypi

These are notes so we can remember how to dump / restore the packages database:

  pg_dump -Fc -b packages >packages-20060706.dump
  createdb packages
  pg_restore -O -d packages -Fc packages-20060706.dump

Ask RichardJones if you need a database dump. Note that dumps should not be imported into an existing database that has had the pkdump_schema.sql DDL script run against it. The pg_dump file will create all of the database tables, columns, indexes, foreign keys, etc. that are required.

PageTemplates are obtained from:

  svn co svn:// zope.pagetemplate
  svn co svn:// zope.tal
  svn co svn:// zope.interface
  svn co svn:// zope.i18nmessageid
  svn co svn:// zope.tales

We also need to install ez_setup, celementtree, docutils, psycopg2, and M2Crypto.

# For debian, this should get you most of the dependencies. apt-get install zope3 python-celementtree python-psycopg

Then go ahead and edit pypi.ini and this line in pypi.cgi:

  cfg = config.Config('/tmp/pypi.ini', 'webui')

if your config.ini isn't in /tmp/pypi.ini. You can leave it as 'config.ini' if it's in the same directory as

You will need to add cheesecake_password=yourpasshere into the config.ini in the webui section.

To integrate it with Apache, we recommend to use WSGI through mod_wsgi. Your configuration should look like this:

   WSGIDaemonProcess pypi display-name=wsgi-pypi python-path=/usr/lib/zope2.9/lib/python processes=4 threads=1
   WSGIProcessGroup pypi
   WSGIPassAuthorization On
   WSGIScriptAlias /pypi /data/pypi/src/pypi/pypi.wsgi
   WSGIScriptAlias /simple /data/pypi/src/pypi/pypi.wsgi


CheeseShopDev (last edited 2016-08-08 02:59:38 by mbussonn)

Unable to edit the page? See the FrontPage for instructions.