Search code examples
pythonpypi

How can I roll my own PyPI? For example, for 'egg' distribution


I would like to run my own internal PyPI server, for egg distribution within my organization.

I have found a few projects, such as:

As I understand it, pypi.python.org uses software called Cheese Shop.

My questions:

  1. Why can't I use Cheese Shop itself? (I can't find it and am not sure it exists)
  2. How do other people solve this problem? (Currently we use blush SVN to distribute 'eggs')

This seems canonical: The Python Wiki, Python Implementations. Still, I'm interested in feedback.

How can I roll my own PyPI?


Solution

  • Update: PyPi is now powered by Warehouse, which is the replacement for Cheese Shop.

    The source to Cheese Shop can be downloaded from https://bitbucket.org/pypa/pypi/src. There is also an example, from the page you linked to, of using Apache as a "dumb" Python package repository:

    # Mount pypi repositories into URI space
    Alias /pypi   /var/pypi
    
    # /pypi/dev: Redirect for unknown packages (fallback to pypi)
    RewriteCond   /var/pypi/dev/$1 !-d
    RewriteCond   /var/pypi/dev/$1 !-f
    RewriteRule   ^/pypi/dev/([^/]+)/?$ http://pypi.python.org/pypi/$1/ [R,L]
    
    RewriteCond   /var/pypi/dev/$1/$2 !-f
    RewriteRule   ^/pypi/dev/([^/]+)/([^/]+)$ http://pypi.python.org/pypi/$1/$2 [R,L]
    
    # /pypi/stable: Redirect for unknown packages (fallback to pypi)
    RewriteCond   /var/pypi/stable/$1 !-d
    RewriteCond   /var/pypi/stable/$1 !-f
    RewriteRule   ^/pypi/stable/([^/]+)/?$ http://pypi.python.org/pypi/$1/ [R,L]
    
    RewriteCond   /var/pypi/stable/$1/$2 !-f
    RewriteRule   ^/pypi/stable/([^/]+)/([^/]+)$ http://pypi.python.org/pypi/$1/$2 [R,L]