Package: versionflow
versionflow 0.4.0Automatic Semantic Versioning with Git Flow.The point of versionflow is to enhance theGit Flowbranching model with an automated approach tosemantic versioningof 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.Installationversionflowis a Python package. With a Python installation, dopip install versionflowto install it.Getting Started With versionflowversionflowworks on two assumptions: that you will use the Git Flow methodology for development, and that you want to tag commits on themasterbranch 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. Youcoulddo all that by hand, but luckilyversionflowcan do it for you. Just runversionflow initin youir project's root directory andversionflowwill 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 checkThis 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 minorThat'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.Using the version number in codeIt's nice to have a version number in the tags of your repo which you can easily manage from the command line, but your code itself might want to make use of the same number. This is simple with versionflow - just write the current version number in any of your files, thenversionflow addthose files. From now on those files will be modified byversionflowwhenever it updates the current version number. Any instances of the old version number in the specified files will be replaced by the new version number.For example, suppose we add aREADME.mdfile to the above example. In that file we put# My awesome program v0.1.0

It's 1337!We don't want to have to manage that version number by hand. So we doversionflow add `README.md`We do some more development and now we're ready to release v.0.2.0, so we runversionflow minorNowversionflowwill bump the version in both its own configurationandtheREADME.mdfile, merge the develop branch into master, and tag the resulting commit with "0.2.0".README.mdnow looks like this:# My awesome program v0.2.0

It's 1337!We never have to worry about manually updating the version number in the README ever again. You can add as many files as you want toversionflowand it will update the version number in all of them.CommandscheckCheck 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 themasterbranch matching the versionflow config?initInitialise 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).majorCreate a release of this project from the latest commit ondevelopmentwith the major version number bumped.minorCreate a release of this project from the latest commit ondevelopmentwith the minor version number bumped.patchCreate a release of this project from the latest commit ondevelopmentwith the patch version number bumped.describeShow just the current version number in the repo, including a description of the current/parent commit if it is untagged.addAdd a file toversionflow.Common OptionsAll 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 messageDevelopmentTo create an environment in which to developversionflow, clone the git repository and create a Python virtual environment using virtualenv. Then in the cloned repo, using the virtual environment, dopip -r requirements-dev.txtThis will install all the Python modules needed for developing versionflow.TestingIt 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 insetup.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 dopip 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.Acknowledgementsversionflowuses:setuptools_scmto find version numbers from commit tags;nu-gitflowto perform Git Flow actions;bump2versionto increment version numbers in files;andgitpythonto perform miscellaneous git actions.