I wanted the simplest (i.e. most lightweight) possible repository capable of serving packages in such a way as that Python’s pip would be able to install them. These notes are so that I don’t forget how I solved the task.
I create a new directory on a Web server (e.g. nginx) and permit the server to show a directory listing. Then I install the packages I need into directories named by package:
.
├── airports
│ └── airports-0.2.tar.gz
└── paho-mqtt
└── paho-mqtt-1.5.0.tar.gz
That’s it.
On the client side, I configure /etc/pip.conf
so that pip uses my repository. The directives are documented.
[global]
index = http://10.53.1.1/pip/
index-url = http://10.53.1.1/pip/
trusted-host = 10.53.1.1
That’s it.
$ python3.7 -m venv j0
$ source j0/bin/activate
(j0) $ pip install airports
Looking in indexes: http://10.53.1.1/pip/
Collecting airports
Downloading http://10.53.1.1/pip/airports/airports-0.2.tar.gz (144kB)
|████████████████████████████████| 153kB 5.2MB/s
Collecting paho-mqtt (from airports)
Downloading http://10.53.1.1/pip/paho-mqtt/paho-mqtt-1.5.0.tar.gz (99kB)
|████████████████████████████████| 102kB 5.9MB/s
Installing collected packages: paho-mqtt, airports
Running setup.py install for paho-mqtt ... done
Running setup.py install for airports ... done
Successfully installed airports-0.2 paho-mqtt-1.5.0
(j0) $
Rune calls in to tell me about pip2pi which can pull in packages from pip and install them into a local directory which I then serve or make available somehow. Basically an easy way to copy packages and their dependencies.