Skip to main content

Builds a pythonic version number based on scm tags and branches

Project description

setup_scmversion

Builds a semantic version number based on information available on your scm (tag, branch, and number of commits).

See LICENSE for important licensing information.

Instalation

pip install jfaleiro.setup-scmversion

Currently only git is supported.

Use

A semantic version number is created from standard data available in your scm, i.e. tag, branch name, and number of commits from a tag or master. It supports a simple workflow:

  • Versions follow a simplified semantic versioning scheme.
  • Non-production releases are produced from release branches named release/<version>.
  • Non-production releases are produced from feature-releases named feature/<version>.
  • Production releases and releases candidates are generated from a tag in master after a release branch is merged to master. The version will match the tag.

Simplest Use

Should apply to most projects. Tag the current version before build or deploy using a command line:

$ scmversion version
0.0.1.dev1
V=`scmversion version`
echo $V
0.0.1.dev1

or the type of version:

$ scmversion version-type
RELEASE_BRANCH

The type of version can be one of RELEASE, RELEASE_BRANCH, FEATURE_BRANCH, or OTHER.

Setuptools

Add this on the very top of your setup.py:

try:
    from ._version import __version__  # noqa: F401
except ImportError:  # pragma: no cover
    __version__ = "none"
...

Add these parameters to version, setup_requires, and entry_points arguments of setup:

setup(
    version=__version__,
	...
    setup_requires=['jfaleiro.setup-scmversion'],
	...
    entry_points={
        "distutils.commands": [
            "tag-version = setup_scmversion.command:TagVersionCommand"
        ]
    },
)

From there you can tag your version using setuptools:

./setup.py tag-version

Versioning Schema

  • Release branches release/<version> with nnn differences from master will produce a RELEASE_BRANCH with a version <version>.dev<nnn>
  • Feature branches feature/<version> with nnn differences from master will produce a FEATURE_BRANCH with a version <version>.dev<nnn>
  • A tagged version <tag> on master will produce a RELEASE version <tag>.
  • Everything else will produce master.dev<nnn> for master or no-version.dev<nnn> for any other branch.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jfaleiro.setup_scmversion-0.0.3-py3-none-any.whl (27.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page