PyPI is amazing, but it does have its drawbacks:
- If PyPI is down, you can’t download any packages or run any tests
- PyPI can be extremely slow at times
- PyPI doesn’t offer private package support
The solution? set up a local PyPI mirror of course.
Python already has a PEP that describes the mirroring infrastructure for PyPI: PEP 381, and the tooling that implements it.
I started by looking at my options, and at the end decided to follow these articles to do so:
- I read Create a local PyPI mirror. Instead of using pep381client, I used bandersnatch..
- I used this tutorial to setup nginx. I tried pypiserver, but the performance wasn’t good enough.
- Then I read pip’s configuration guide to make it use my local mirror.
During my search endeavours, I found out that Artifactory provides support for PyPI repositories. If you already have it installed, I suggest using it instead.