Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to roll my own pypi?

Tags:

python

pypi

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

I have found a few projects, such as:

  • http://pypi.python.org/pypi/EggBasket/
  • http://plone.org/products/plonesoftwarecenter

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

My questions:

  1. Why can't I use cheeseshop itself? (I can't find it, not sure it exists)
  2. How do other people solve this problem? (Currently we use blush svn to distribute eggs)

*edit: This seems canonical http://wiki.python.org/moin/PyPiImplementations. Still, I'm interested in feedback.

like image 224
drue Avatar asked Aug 05 '09 19:08

drue


3 Answers

For light-weight solution, use pypiserver.

like image 100
wangeek Avatar answered Nov 09 '22 18:11

wangeek


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]
like image 16
John Millikin Avatar answered Nov 09 '22 19:11

John Millikin


Warehouse

Warehouse would be your best bet in 2017. From the project's README:

Warehouse is a next generation Python Package Repository designed to replace the legacy code base that currently powers PyPI

...

You can run Warehouse locally using docker and docker-compose. See Getting started in the documentation for instructions on how to set it up.

It is maintained by The Python Packaging Authority (PyPA) who work in cooperation with members of the Python core development team, and there is a live version running at https://pypi.org/ which mirrors everything in the legacy PyPI (https://pypi.python.org/).

like image 9
Day Avatar answered Nov 09 '22 19:11

Day