Skip to main content

Generate version strings based on semantic versioning rules.

Project description

Travis CI Code Health

Helper tool to generate version strings based on semantic versioning rules. It provides a shell command which you can use in bash scripts and comes with Python classes which you can integrate in your code.

Installation

pip install versionbump

Usage

usage: versionbump [-h] -c CURRENT [-q] [-i]
               {major,minor,patch} [file [file ...]]

Arguments

  • -c / --current: Assume current version. (required)

  • -h / --help: Print help text and exit.

  • -q / --quiet: Don’t write anything to stdout.

  • -i / --ignore: Ignore invalid files

Increase version

$ versionbump -c 0.1.2 patch
0.1.3

Replace version in file(s)

$ cat version.txt
Current version: 0.1.2
$ versionbump -c 0.1.2 minor version.txt
0.1.3
$ cat version.txt
Current version: 0.1.3

If you want to replace the version string in more than one file, just pass them to versionbump aswell. Example:

$ versionbump -c 0.1.2 major file1.txt file2.txt file3.txt

Python library

VersionBump

from versionbump import VersionBump
vb = VersionBump('2.0.1')
vb.bump()              ## default value: 'patch'
print vb.get()         ## 2.0.2
print vb.get('patch')  ## 2

FileBump

from versionbump import FileBump
fo = open('version.txt', 'r+')
fb = FileBump(fo, '2.0.1')
fb.bump()              ## default value: 'patch', writes to file
print fb.get()         ## 2.0.2
print fb.get('patch')  ## 2

Alternatives

  • bumpversion by Filip Noetzel. Provides much more functionality like VCS integration.

  • grunt-bump by Vojta Jina. Integrates with the task runner grunt.

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

versionbump-1.1.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file versionbump-1.1.0.tar.gz.

File metadata

  • Download URL: versionbump-1.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for versionbump-1.1.0.tar.gz
Algorithm Hash digest
SHA256 399a050d962e92d70300bf5729230d168baf909f88bb5019cbc76cc5936a22bd
MD5 d481c2e2c55bb69d9f49836a8864832f
BLAKE2b-256 5d82378bbe6a0399e11571dbce69f41df640981def49cab277a3cd02c45a602d

See more details on using hashes here.

Supported by

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