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
inmaster
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>
withnnn
differences from master will produce aRELEASE_BRANCH
with a version<version>.dev<nnn>
- Feature branches
feature/<version>
withnnn
differences from master will produce aFEATURE_BRANCH
with a version<version>.dev<nnn>
- A tagged version
<tag>
on master will produce aRELEASE
version<tag>
. - Everything else will produce
master.dev<nnn>
for master orno-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
Built Distribution
Hashes for jfaleiro.setup_scmversion-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c2d8abaed02089882b0e283d08d08e8038722b8e71d891a8e979e71a25e096 |
|
MD5 | 3659252d8a2f689610dd0182cbcad145 |
|
BLAKE2b-256 | 5f278d6b62a09bc5404279751f3d04f0f55a8ef5d546853e6f5e2ab802dff6f3 |