Skip to main content

No project description provided

Project description

versup

License: MIT Documentation Status PyPI version Build Status Coverage Status Code style: black

Bump 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.

Install

Install with either poetry

poetry install

or pip

pip install .

Quick start

To 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 as patch, minor, major etc, or an entirely new semantic version like 1.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.

Configuration

One intial launch, versup copies a default config to your home directory (~/.config/versup.json) which has some good defaults.

{
    "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",
            "premajor",
            "preminor",
            "prepatch",
            "prerelease",
            "custom",
        ],  # 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
    },
    "tag": {
        "enabled": True,  # Tag the bump commit
        "name": "v[version]",  # Template for the name of the tag
    },
    "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
        "prerelease": "",  # Script to execute before releasing
        "postrelease": "",  # Script to execute after releasing
    },
}

You can edit this file to affect all bumps, or create a .versup.json file in your project root and versup will use these values to override the global ones.

Template tags

In various places you can define what text to use for commit messages, or tags etc. These support tag fields that are replaced with information. Know fields are:

  • version: The new version
  • message: The new commit message
  • date: Today's date formatted according to tokens/date/format in the config
  • version_date: Today's date formatted according to tokens/version_date/format in the config
  • hash: The new commit hash, full length
  • hash4: The new commit hash, first four characters
  • hash7: The new commit hash, first seven characters
  • hash8: The new commit hash, first eight characters
  • author_name: The author name from the git config
  • author_email: The author email from the git config

Updating files

versup 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 file README.rst is updated by matching a regex Version ([\\d\\.]+) which will match any text like Version 1.3 or Version 1.3.7. They are standard regular expressions. The text that is matched is then replaced with the next argument Version [version] where [version] is the new version. You can regex and replace on anything really.

Scripts

There are a number of pre and post scripts that can be executed at various stages of the bump process. These are under the scripts section. 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 at https://versup.readthedocs.io

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

versup-1.0.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

versup-1.0.3-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file versup-1.0.3.tar.gz.

File metadata

  • Download URL: versup-1.0.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.8 Linux/5.4.0-42-generic

File hashes

Hashes for versup-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c60adfbae7a6806b01ed7ee1403cabe8b0db08d4b5c1daf872c7bd9e9fa8467e
MD5 939d4a3ae245ac605321d55d13db5ddb
BLAKE2b-256 8058c7e53de29d8d0aff9ad0912ceeed9f6f3fd1eae49b3a57d4340efb8624dc

See more details on using hashes here.

File details

Details for the file versup-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: versup-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.8 Linux/5.4.0-42-generic

File hashes

Hashes for versup-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41787486bd605c400e1b60c0dc77b9cbc41e40d67e47c3c17f3237ad9dfe5e94
MD5 4048097736e6b721c2e4adc2b3115b21
BLAKE2b-256 5cb9d94c5f5e2bea1758930720aaeb6e88dd5c8e77c073f2085e022c88ce4502

See more details on using hashes here.

Supported by

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