PyPI is slow. How do I run my own server?

前端 未结 5 918
别那么骄傲
别那么骄傲 2020-12-12 17:18

When a new developer joins the team, or Jenkins runs a complete build, I need to create a fresh virtualenv. I often find that setting up a virtualenv with Pip and a large nu

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 17:57

    Do you have a shared filesystem?

    Because I would use pip's cache setting. It's pretty simple. Make a folder called pip-cache in /mnt for example.

    mkdir /mnt/pip-cache
    

    Then each developer would put the following line into their pip config (unix = $HOME/.pip/pip.conf, win = %HOME%\pip\pip.ini)

    [global]
    download-cache = /mnt/pip-cache
    

    It still checks PyPi, looks for the latest version. Then checks if that version is in the cache. If so it installs it from there. If not it downloads it. Stores it in the cache and installs it. So each package would only be downloaded once per new version.

提交回复
热议问题