Skip to content

Deployment

Mostafa Jahanifar edited this page Feb 17, 2021 · 1 revision

Python Packaging

For general python packaging guides and tutorials see the official python packaging user guide and the setuptools documentation.

Packaging python projects guide:

https://packaging.python.org/tutorials/packaging-projects/

Example Project:

https://github.com/pypa/sampleproject

Deployment Workflow

For the development workflow see. This section picks up after the develop branch is ready for a test release or a proper deployment. This assumes that pull requests and already been code reviewed and is about to be merged into develop and/or master.

Proceed with cation here, changes could be going live to users.

Update Dependencies

Remember to update new or removed dependencies in setup.py.

Bump Version

Bump2Version is used to increment the package version number. See Semantic versioning below to gauge when to bump each version number part.

Running bump2version will find and replace the current version number in project files with the new version number. It, by default, also commits this change and adds a tag to the commit.

A tag on a commit in the develop or master triggers a build of the package via TravisCI. Develop branch tags deploy to test PyPI and master branch tags trigger a production deployment to PyPI.

General Usage

bump2version [options] part [file]

If file is not given, the list of [bumpversion:file:...] sections from the setup.cfg configuration file will be used. These are currently setup.py and tiatoolbox/__init__.py.

Example: Bumping Minor Part From 0.5.1 to 0.6.0 

bump2version --current-version 0.5.1 minor

Example: Bumping PatchPart From 0.1.0 to 0.1.1

bump2version patch

Push Tagged Commit

At this point the local version bump and tagged commit are all in place and will trigger a deployment if merged into / pushed to the develop or master branches. This will make the changes available on PyPi.

To push with the tag:

 

$ git push --follow-tags

Username for '<https://github.com>': tialab

Password for '<https://[email protected]>':

Counting objects: 1, done.

Writing objects: 100% (1/1), 183 bytes | 183.00 KiB/s, done.

Total 1 (delta 0), reused 0 (delta 0)

To <https://github.com/TIA-Lab/tiatoolbox.git>

* [new tag] v0.1.1 -> v0.1.1

PyPI

PyPI is the official python package index. Tagged commits on the master branch get deployed here. This means that it will be installable via the pip command line tool.

 

PyPI Test

A testing site, test.pypi.org, is also available. It is used for testing deployment changes. Tags on the develop branch are also deployed here as they may be unstable and they should not be installed by users, unless they are testing for bugs and stability.

Semantic Versioning

A three point MAJOR.MINOR.PATCH version numbering scheme is used in line with semantic versioning 2.0.

  1. MAJOR version when you make incompatible API changes,

  2. MINOR version when you add functionality in a backwards compatible manner, and

  3. PATCH version when you make backwards compatible bug fixes.