Package: versup
versupBump your project version, update version numbers in your files, create a changelog,
make a commit, and tag it, all in one easy step. versup is also quite configurable.InstallInstall with either poetrypoetry installor pippip install .Quick startTo get started all versup needs to know is the new version increment or number.
You can provide it with a valid semantic version increase such aspatch,minor,majoretc, or an entirely new semantic version like1.2.5.If you specifiy a version number, then versup will take that version and apply
it to the current project as is. If you provide an increment, it will get the
last version number from either the latest git tag that has a valid version,
or from the default version in the config file.ConfigurationVersup has a default configuration which is shown below{
    "force": False,  # Force the command without prompting the user
    "silent": False,  # Minimize the amount of logs
    "files": {},  # A map of `relativeFilePath: [regex, replacement, regexFlags?] | [regex, replacement, regexFlags?][]`
    "version": {
        "enabled": True,  # Bump the version number
        "initial": "0.0.0",  # Initial version
        "increments": [
            "major",
            "minor",
            "patch",
            "prerelease",
            "build",
        ],  # List of available increments to pick from
    },
    "changelog": {
        "enabled": True,  # Enable changelog auto-updates
        "create": False,  # Create the changelog file if it doesn"t exist
        "open": True,  # Open the changelog file after bumping
        "file": "CHANGELOG.md",  # Name of the changelog file
        "version": "### Version [version]",  # Template for the version line
        "commit": "- [message]",  # Template for the commit line
        "separator": "\n",  # Template for the separator between versions sections
    },
    "commit": {
        "enabled": True,  # Commit the changes automatically
        "message": "Update version to [version]",  # Template for the commit message
        "mainbranch": "master",  # name of the main development or release branch
    },
    "tag": {
        "enabled": True,  # Tag the bump commit
        "name": "v[version]",  # Template for the name of the tag in the tag message
    },
    "tokens": {
        "date": {
            "format": "%Y-%m-%d"  # Python datetime format to use when generating the `[date]` token
        },
        "version_date": {
            "format": "%Y-%m-%d"  # Python datetime format to use when generating the `[version_date]` token
        },
    },
    "scripts": {
        "prebump": "",  # Script to execute before bumping the version
        "postbump": "",  # Script to execute after bumping the version
        "prechangelog": "",  # Script to execute before updating the changelog
        "postchangelog": "",  # Script to execute after updating the changelog
        "precommit": "",  # Script to execute before committing
        "postcommit": "",  # Script to execute after committing
        "pretag": "",  # Script to execute before tagging
        "posttag": "",  # Script to execute after tagging
    },
}If you want to override any settings, you can do this by creating a~/.config/versup.jsonfile or a.versup.jsonin your local project. Versup will read its default settings,
then merge in the global config (~/.config/versup.json), and finally
merge in the project level config.Template tagsIn various places you can define what text to use for commit messages, or tags etc.
These support tag fields that are replaced with relevant information. Known fields are:version: The new versionmessage: The new commit messagedate: Today's date formatted according totokens/date/formatin the configversion_date: Today's date formatted according totokens/version_date/formatin the confighash: The new commit hash, full lengthhash4: The new commit hash, first four charactershash7: The new commit hash, first seven charactershash8: The new commit hash, first eight charactersauthor_name: The author name from the git configauthor_email: The author email from the git configUpdating filesversup can update versions in files. The way this works is by configuring a regex
for each file that you want to update. So for example:"files": {
    "README.rst": [
      ["Version ([\\d\\.]+) ", "Version [version] "],
      ["Version is ([\\d\\.]+)", "Version is [version]"]
    ]
  },Here the fileREADME.rstis updated by matching a regexVersion ([\\d\\.]+)which will match any text likeVersion 1.3orVersion 1.3.7. They are standard
regular expressions. The text that is matched is then replaced with the next argumentVersion [version]where[version]is the new version. You can regex and replace on
anything really.The supported increments are those supported byPython SemvermajorminorpatchprereleasebuildScriptsThere are a number of pre and post scripts that can be executed at various
stages of the bump process. These are under thescriptssection. They are
called as-is and receive the new version number as the only argument. They
can be anything, shell scripts, python scripts, etc, but they must be
executable in a regular shell, as they will be invoked as such.Full Read The Docs can be found athttps://versup.readthedocs.io