Automatic Semantic Versioning with Git Flow.
Project description
versionflow
Automatic Semantic Versioning with Git Flow.
The point of versionflow is to enhance the Git Flow branching model with an automated approach to semantic versioning of your software's releases. It installs a command line utility which you can use to check your repo's status, initialise the versionflow approach, and create semantically versioned releases.
Installation
versionflow
is a Python package. With a Python installation, do
pip install versionflow
to install it.
Getting Started With versionflow
versionflow
works on two assumptions: that you will use the Git Flow methodology for development, and that you want to tag commits on the master
branch of your project with semantic version numbers.
To get started with a project, you need to initialise it to use Git and Git Flow, and have a versionflow configuration file. You could do all that by hand, but luckily versionflow
can do it for you. Just run
versionflow init
in youir project's root directory and versionflow
will create a git repo, initialise it with Git Flow branches, create the config file, and tag the first (empty) commit as "0.0.0".
Now we do some work and commit it to our development branch, and we're ready to create our first release! Let's first check that we're ready:
versionflow check
This will run through a few checks to make sure we're ready to start a release:
- We're in a git repo, initialised for Git Flow.
- The repo is clean: there are no tracked files with uncommitted changes.
- We have a versionflow config file, and the version number in it is consistent with the last version tag.
These checks all get done before you can actually perform a versionflow release & bump action, but it's good to be able to see your current status without the possibility of affecting anything.
Now, let's do our release! It's our first one, so we'll say it's a minor release, i.e. we're going to release v0.1.0.
versionflow minor
That's it! versionflow will do the same checks as above, and if everything is OK it will perform a few actions:
- Create a "Release/0.1.0" branch from the current development commit.
- Update the version number in the versionflow configuration file from 0.0.0 to 0.1.0.
- Merging "Release/0.1.0/ into master, and remove the release branch.
- Tag the merge commit on master as "0.1.0".
- Merge the master branch into develop, so that the latest tag and version number in there is 0.1.0.
So now you'll have a nice, consistent repo: the master branch will contain your latest release, tagged to the appropriate version number.
Commands
- check
Check whether this directory is correctly initialised for versionflow, and ready to bump a version number: is it a git repo; is the repo clean (i.e. not dirty); does it have the standard Git Flow branches; does it have a versionflow config file; does it have a semantic version tag on the
master
branch matching the versionflow config? - init Initialise this directory as a versionflow project: create a git repo (if there isn't already one); set up the Git Flow branches (if they don't already exist); and create a versionflow config file (if it does not exist).
- major
Create a release of this project from the latest commit on
development
with the major version number bumped. - minor
Create a release of this project from the latest commit on
development
with the minor version number bumped. - patch
Create a release of this project from the latest commit on
development
with the patch version number bumped.
Common Options
All the commands described above take the following options:
- --repo-dir PATH Use the given PATH as the root of the versionflow repo. Defaults to the current directory.
- --config FILE
Use the given FILE as the versionflow configuration file. Defaults to
.versionflow
. - --version Print the current version of versionflow, and exit.
- --help Print a help message
Development
To create an environment in which to develop versionflow
, clone the git repository and create a Python virtual environment using virtualenv. Then in the cloned repo, using the virtual environment, do
pip -r requirements-dev.txt
This will install all the Python modules needed for developing versionflow.
Testing
It is a good idea to create different testing virtual envs for versionflow as well as your dev environment. This will ensure that the package is configured to install properly via the configuration in setup.cfg
, and that you don't have a hidden dependency on something installed in your dev environment.
To install your development version of versionflow in a testing virtual env, activate it, then do
pip install -e .
in your local copy of the versionflow repo. Now as you work on it your latest changes will always be available in the virtual environment.
Acknowledgements
versionflow
uses:
- setuptools_scm to find version numbers from commit tags;
- nu-gitflow to perform Git Flow actions;
- bump2version to increment version numbers;
- and gitpython to perform miscellaneous git actions.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for versionflow-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe3d2867667d981d171d913cbcd9f4293393603958f3ca74aa548d9e82a62f8d |
|
MD5 | 98323e2a03fdd686992b54461425eddd |
|
BLAKE2b-256 | a54801bc0cea25f6e4cf6d7cf984d54df5fe8d6390f425caa5e304fd6228160e |
Hashes for versionflow-0.3.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43cc0877dd3a8f2192afe8f12eade32c77c0866f70935ef628d442fbcff67d40 |
|
MD5 | df0bd5a0071b96211aafa2c65c6522e5 |
|
BLAKE2b-256 | 4d3df6d85912a1e7d6c3df978ecdb649b881300e2b8907acd65d69a3ba627b03 |