DevPi Server is a local self-updating PyPi caching mirror which works with pip and easy_install. After files are first requested can work off-line and will try to re-check with pypi every 30 minutes by default.
Install DevPi Server globally#
sudo -H pip install devpi-server
sudo devpi-init
Configure DevPi Server to start on boot#
Create a new systemctl service:
sudo nano /etc/systemd/system/devpi.service
[Unit]
Description=Private pypi server by devpi-server
Requires=network-online.target
After=network-online.target
[Service]
Restart=always
ExecStart=/usr/local/bin/devpi-server --host localhost --port 3141
User=root
[Install]
WantedBy=multi-user.target
Reload configuration and start the service:
sudo systemctl daemon-reload
sudo systemctl enable devpi.service
sudo systemctl start devpi.service
Configure pip to point to local mirror#
Create or update your personal pip configuration:
mkdir ~/.config/pip/
nano ~/.config/pip/pip.conf
[global]
trusted-host = localhost
extra-index-url = https://pypi.python.org
[install]
index-url = http://localhost:3141/root/pypi/+simple/
[search]
index = http://localhost:3141/root/pypi/
From now on, each pip install command will be resolved by DevPi Server. Requested packages will be served from cache, or fetched from PyPi if not found.
