Setup
Assuming you are in your desired folder and have activated a virtual environment
pip install devpi-server devpi-web devpi-clientdevpi-initdevpi-gen-config --port 8080supervisord -c gen-config/supervisord.conf
After that, devpi should be up and running under localhost:8080.
Before we're doing any further steps regarding network setup, let's do a minimal configuration.
devpi use http://localhost:8080devpi login root --password ''devpi user -m root password=123devpi logoff
After we changed the root password, let's create a user
devpi user -c alice password=456 email=alice@example.comdevpi login alice --password=456
Now, we're ready to create an index (e.g. foo) for this specific user
devpi index -c foo bases=root/pypi
Security
After following the above steps, we're done. You can proceed with the following steps by either having all locally installed or initiating an SSH tunnel.
However, if you're running on a server and want to make the package index public available, follow the next steps to add at least some security.
For simplicity, the other setup steps will assume having everything on localhost nevertheless.
On a production setup, you should use a configuration file for devpi and a reverse proxy such as nginx.
- after running
devpi-init, head to.devpi/serverand create a fileserver.conf - paste the following into the file:
devpi-server: serverdir: /home/devpi/.devpi/server secretfile: /home/devpi/.devpi/secret/.secret host: localhost port: 8080 - run
devpi-gen-config -c /home/devpi/devpi/server/server.conf - copy the nginx configuration to the
sites-availablefolder and proceed with [[certbot]] - run
devpi-server -c /home/devpi/devpi/server/server.confto check if everything's running well -
create a systemd file as follows:
[Unit] Description=devpi Requires=network-online.target After=network-online.target [Service] User=devpi Group=devpi WorkingDirectory=/home/devpi/.devpi/server Restart=on-success ExecStart=/home/devpi/.venv/bin/devpi-server -c /home/devpi/.devpi/server/server.conf [Install] WantedBy=multi-user.target - head back to the previous section and set root password accordingly, then enable and start the service
Publishing
Assuming you have Poetry installed
poetry new bar- implement your module
poetry add devpi-client -G devpoetry run devpi use http://localhost:8080poetry run devpi login alice --password=456poetry run devpi use alice/foopoetry config repositories.foo http://localhost:8080/alice/foopoetry config http-basic.foo alice 456poetry publish -r foo
Installation
Assuming you have Poetry installed
poetry source add --priority=supplemental foo http://localhost:8080/alice/foo/+simple/poetry add --source foo bar