Required packages

To run the PyPI software, you need Python 2.5+ and PostgreSQL

Quick development setup

Make sure you read and you have a working PostgreSQL DB.

Make sure your config.ini is up-to-date, initially copying from config.ini.template. Change CONFIG_FILE at the begining of pypi.wsgi, so it looks like this:

CONFIG_FILE = 'config.ini'

Then, you can create a development environment like this, if you have virtualenv installed:

$ virtualenv --no-site-packages .
$ pip install -r requirements.txt

Then you can launch the server using the pypi.wsgi script:

$ python pypi.wsgi
Serving on port 8000...

PyPI will be available in your browser at http://localhost:8000

Database Setup

To fill a database, run pkgbase_schema.sql on an empty Postgres database. Then run tools/demodata to populate the database with dummy data.

For testing purposes, run tools/mksqlite to create packages.db. Set [database]driver to sqlite3, and [database]name to packages.db, then run tools/demodata to populate the database.

PyPI Requires the citext extension to be installed.

TestPyPI Database Setup

testpypi runs under postgres; because I don't care to fill my head with such trivialities, the setup commands are:

createdb -O testpypi testpypi psql -U testpypi testpypi <pkgbase_schema.sql

Restarting PyPI

PyPI has 2 different pieces that need started, web server and the task runner.

# Restart the web server $ /etc/init.d/pypi restart # Restart the task runner $ initctl restart pypi-worker

Clearing a stuck cache

Users reporting stale data being displayed? Try:

curl -X PURGE

(where the URL is the relevant one to the issue, I presume)

To see what fastly thinks it knows about a page (or how it's getting to you) try:

curl -I -H 'Fastly-Debug: 1'