From 928e9bc7f07d217e5867fd7afd3fd3ed1354ad83 Mon Sep 17 00:00:00 2001 From: Peter Boin Date: Tue, 18 Jul 2017 23:07:29 +1000 Subject: [PATCH] notes on deployment --- deployment.md | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 deployment.md diff --git a/deployment.md b/deployment.md new file mode 100644 index 0000000..fb7b164 --- /dev/null +++ b/deployment.md @@ -0,0 +1,102 @@ +# Notes on deployment + +How I deployed this package (mainly just notes for myself) + +Method based on the articles: + + * http://peterdowns.com/posts/first-time-with-pypi.html and + * https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/ + + +## Pre-requisites + +``` +pip install -U "pip>=1.4" "setuptools>=0.9" "wheel>=0.21" twine +``` + +## PyPi rc + +`cat ~/.pypirc` + +``` +[distutils] +index-servers = + prod + test + +[prod] +repository = https://upload.pypi.org/legacy/ +username=FraggaMuffin +password=secret + +[test] +repository=https://test.pypi.org/legacy/ +username=FraggaMuffin +password=secret +``` + +`chmod 600 ~/.pypirc` + + +## Building + +``` +rm -rf build/ +python setup.py sdist bdist_wheel +``` + +### Test Build (sdist) + +**Python 2.x** + +``` +rmvirtualenv 27-test +mkvirtualenv 27-test + +$WORKON_HOME/27-test/bin/pip install dist/pygcode-0.1.0.tar.gz + +$WORKON_HOME/27-test/bin/python + +>>> import pygcode +>>> pygcode.Line('g1 x2 y3 m3 s1000 f100').block.gcodes # or whatever +``` + +**Python 3.x** + +``` +rmvirtualenv 35-test +mkvirtualenv -p $(which python3) 35-test + +$WORKON_HOME/35-test/bin/pip install dist/pygcode-0.1.0.tar.gz + +$WORKON_HOME/35-test/bin/python + +>>> import pygcode +>>> pygcode.Line('g1 x2 y3 m3 s1000 f100').block.gcodes # or whatever +``` + +### Test Build (wheel) + +similar to above, but the `pip` call references `pygcode-0.1.0-py2.py3-none-any.whl` instead + +make sure to `rmvirtualenv` to ensure `pygcode` is uninstalled from virtual environment + + +## Upload to PyPi Test server + +`twine upload -r test dist/pygcode-0.1.0*` + +Then another round of testing, where `pip` call is: + +`$WORKON_HOME//bin/pip install -i https://testpypi.python.org/pypi pygcode` + + +## Upload to PyPy server + +all good!? sweet :+1: time to upload to 'production' + +`twine upload -r prod dist/pygcode-0.1.0*` + +and final tests with simply: + +`$WORKON_HOME//bin/pip install pygcode`