Once you have your packages installed to your custom pypi server, you can have your pip
refer to it like so:
a. If you use requirements.txt to install your module:
Sample requirements.txt:
--find-links http://10.10.161.9:8080/packages/
custom-python-package==0.1.1
b. If you use setup.py to install your module:
# Sample setup.py
from setuptools import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='spidey-web',
version='1.0',
author='Spiderman',
author_email='spiderman@gmail.com',
description='A business project for Spiderman',
test_suite='nose.collector',
dependency_links=['http://10.11.12.13:8080/packages/'],
install_requires=required,
url='https://github.com/Spiderman/spidey-web'
)
Sample requirements.txt:
custom-python-package==0.1.1
But for all of that to work you need to setup PyPi to look into the custom PyPi server:
Configuration for locating packages in pypi server:
a. Make sure pip is installed.
b. Create a file: /home/spiderman/.pip/pip.conf with contents:
[global]
extra-index-url = http://10.11.12.13:8080/simple
c. If you are using Pycharm then create: /root/.pip/pip.conf with contents mentioned below:
[global]
extra-index-url = http://10.11.12.13:8080/simple
NOTE: Replace 10.11.12.13 the ip address where your PyPi server is running
d. export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
To be able to deploy to custom PyPi server:
To be able to deploy to the custom pypi server, you need to create a file called /home/spiderman/.pypirc:
[distutils]
index-servers = pyrack
[pyrack]
repository: http://10.10.161.9:8080
username: <username>
password: <password>
And you are done. Now you can deploy and install from your custom pypi server.