Warning |
---|
DevPI is no longer in use. See https://renalregistry.atlassian.net/wiki/spaces/ST/pages/1443200266/Python+Dependency+Management#Git-dependencies instead |
Installing DevPi Server
Preferred environment is Python 2.7 with pip, virtualenv installed.
Install the server
Code Block language bash mkdir -p /opt/devpi/data cd /opt/devpi scl enable python27 bash virtualenv venv source venv/bin/activate pip install --upgrade pip pip -q -U devpi-server
The data area needs to be initialised using
Code Block language bash cd /opt/devpi/ source venv/bin/activate devpi-server --serverdir /opt/rh/devpi/data --init
The server is run with the commands
Code Block language bash cd /opt/devpi/ source env/bin/activate # Drop the --start to run in the forground # --stop --status --log also available devpi-server --port 3141 --serverdir /opt/rh/devpi/data --start
Warning title Running devpi in the background When running devpi in the foreground relative paths can be used for
--serverdir
however if using the --start option to run in the background a full path must be used or the service will fail to start.A proxy can be setup and it is assumed nginx will be used and the service runner needs to be set up to redirect to the devi-pi. Example configs (but not init.d) can be generated by running the
devpi-server with --gen-config
devpi is currently configured on the jira/bitbucket/confluence server using an apache proxy and is accessible at the following url https://devpi.renalregistry.nhs.uk.
devpi-server is started and stopped using scripts in /opt/devpi/bin
. These are called from an init.d
script located in /etc/init.d/devpi
.
...
...
/etc/init.d/devpi
Code Block | ||
---|---|---|
| ||
#!/bin/bash # # devpi Startup script for the devpi server # # chkconfig: 2345 95 05 # description: devpi server for private package indexes and PyPI caching # # devpi Linux service controller script cd "/opt/devpi/bin" case "$1" in start) ./start-devpi.sh ;; stop) ./stop-devpi.sh ;; restart) ./stop-devpi.sh ./start-devpi.sh ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac |
Info |
---|
The current set up of devpi server on the jira/Bitbucket server runs RedHat 6 and doesn't use the default httpd but uses httpd v2.4 which means it is installed via the the software collection and referenced as httpd24 with config files stored in |
Upgrading the Server
Code Block |
---|
/etc/init.d/devpi stop cd /opt/devpi scl enable python27 bash source venv/bin/activate pip install -U pip pip install -U devpi-server /etc/init.d/devpi start |
...
Note |
---|
The version of Pip supplied with Python 3.6 no longer works with DevPi. Before following these steps upgrade it to the latest version. |
Code Block language bash pip install devpi-client
Create a pip.ini file
For your local machine:
Code Block language bash mkdir ~/pip cd ~/pip touch pip.ini cat > pip.ini [global] index_url = https://devpi.renalregistry.nhs.uk/ukrr/dev/+simple/ [search] index = https://devpi.renalregistry.nhs.uk/ukrr/dev/ CTRL-D
GS: Mine is in C:\Users\MY_USERNAME\AppData\Roaming\pip
On rr-bamboo,
for 32bit Python (27 and 36 in our case), add the pip.ini file to the
C:\Windows\system32\config\systemprofile\pip
folderFor 64 bit Python (36 in our case), add the above pip.ini file to the
C:\Windows\SysWOW64\config\systemprofile\pip
folder
Configuring DevPi Server
Create a root user:
Code Block language bash devpi use https://devpi.renalregistry.nhs.uk devpi login root --password '' devpi user -l devpi logoff
Create a user named 'ukrr' with the following:
Code Block language bash devpi user -c ukrr password=registry email=rrsystems@renalregistry.nhs.uk
Login and create the initial indices:
Code Block language bash devpi login ukrr --password=registry devpi index -c ukrr/release bases=root/pypi ['volatile=False'] devpi index -c ukrr/staging bases=ukrr/release ['volatile=False'] devpi index -c ukrr/dev bases=ukrr/staging ['volatile=True']
Initial seed of pips:
Code Block devpi login ukrr devpi use https://devpi.renalregistry.nhs.uk/ukrr/release/ devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\lxml-3.6.4-cp27-cp27m-win32.whl" devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\pywin32-220.1-cp27-cp27m-win32.whl" devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\pysvn-1.7.10-cp27-cp27m-win32.whl" devpi upload --index ukrr/dev "R:\0 Software\Python\2.7_32bit\PyQt4-4.11.4-cp27-none-win32.whl"
The lxml, pywin32 and PyQt pips were obtained from http://www.lfd.uci.edu/~gohlke/pythonlibs/
The pysvn pip has to be built using https://github.com/ferraith/pysvn-wheeler Instructions are contained in the download.I noticed when I uploaded pyinstaller 3.3 (for tpckd_validation, python 3.5), devpi refused to search the main indices for other versions of same modules. Setting up a mirror allowed access to the tip version, so if you want a previous version, this needs to be uploaded by hand. Fetch the source from pypi, and build the wheel using python setup.py bdist_wheel (remember to use the right version of python for the target wheel).
Related articles
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
hidden | true |
---|
...