This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
pypi [2014/08/12 11:33] mantis |
pypi [2015/11/05 09:55] (current) mantis [Server] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Server ====== | ||
+ | Install prerequisites: | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt-get install python-pip | ||
+ | sudo pip install pypiserver passlib | ||
+ | mkdir -p /opt/pypi/packages | ||
+ | </code> | ||
+ | |||
+ | Add users who can upload packages | ||
+ | <code bash> | ||
+ | htpasswd -c /path/to/.htaccess myusername | ||
+ | </code> | ||
+ | |||
+ | Start the server | ||
+ | <code bash> | ||
+ | pypi-server -p 8080 -P /path/to/.htaccess /opt/pypi/packages | ||
+ | </code> | ||
+ | |||
+ | |||
+ | And visit your server via http | ||
+ | |||
+ | http://myserver:8080/ | ||
+ | |||
+ | |||
+ | Find more information at https://pypi.python.org/pypi/pypiserver | ||
+ | |||
+ | ====== Build and upload packages ====== | ||
+ | |||
+ | ===== Setup your Python project ===== | ||
+ | |||
+ | .... | ||
+ | |||
+ | Verify buildability | ||
+ | <code bash> | ||
+ | python setup.py bdist_egg | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Prepare pip upload ==== | ||
+ | |||
+ | Edit or create a ~/.pypirc file with the following content: | ||
+ | <code> | ||
+ | [distutils] | ||
+ | index-servers = | ||
+ | pypi | ||
+ | internal | ||
+ | |||
+ | [pypi] | ||
+ | username:pypiusername | ||
+ | password:pypipasswd | ||
+ | |||
+ | [internal] | ||
+ | repository: http://127.0.0.1:8080 | ||
+ | username: myusername | ||
+ | password: mypasswd | ||
+ | </code> | ||
+ | |||
+ | |||
+ | And upload your egg to the server 'internal': | ||
+ | |||
+ | <code bash> | ||
+ | python setup.py sdist upload -r internal | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ====== Install from your server ====== | ||
+ | |||
+ | |||
+ | Now you are ready to (re)install | ||
+ | <code bash> | ||
+ | sudo pip install --upgrade --force-reinstall -i http://127.0.0.1:8080/simple/ myegg | ||
+ | </code> | ||
+ | More infos e.g. here http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/ |