Setting Up Your Own PyPi Server
Ever had problems with PyPi being unreachable? Dislike dealing with requirement.txt files just to support a git repository? For a low low price of FREE, and an hour of labor, get your very own PyPi server and solve all of your worries!
Set up Chishop
We’re going to jump right into this one. Start by setting up Chishop. Currently the best way is to do so using the DISQUS fork as it contains several fixes. Expect to see all of the hard work in the various forks merged upstream as soon as we get some proper docs going. Follow the instructions in the README to configure Chishop, and your PyPi index.
Now you’re going to want to tweak some things that are on by default. For starters, you’re probably going to want to proxy the official PyPi repository, and this can be done by enabling a simple flag in your newly created
There are many other configuration options, but you’re going to have to read the source for those.
Now that you’ve got a sexy PyPi server up and running, you’ll probably want to configure the default index locations for your package managers. It took me a bit of Googling but then I stumpled upon an awesome post by Jacob Kaplan-Moss about dealing with PyPi when it goes down, which describes procedures for configuring PyPi mirrors.
Let’s start with pip, which stores its configuration in
[global] index-url = http://my.chishop/simple
Next up, setuptools, located in
[easy_install] index_url = http://my.chishop/simple
And finally, if you use buildout, tweak your
[buildout] index = http://my.chishop/simple
Now that you have a fully functioning PyPi, kill off your requirements files and build a real setup.py. Hopefully as a bit of inspiration, here’s a snippet from Sentry’s:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46