Skip to main content

Library for bumping project version like a pro

Project description


travis appveyor MIT License

Library for bumping project version.

Available schemes:

  • calver
  • comver
  • pep
  • roman
  • romver
  • semver
  • serial
  • zerover

Available rules (and aliases):

  • init -- initialize versioning
  • Main parts:
    • major (breaking)
    • minor (feature)
    • patch (fix, micro)
  • Additional parts:
    • dev
    • local
    • post
  • Pre-release management:
    • pre (rc, alpha, beta)
    • premajor (prebreaking)
    • preminor (prefeature)
    • prepatch (prefix, premicro)
    • release

Read more about schemes and rules in the documentation for dephell project bump.


install from PyPI:

python3 -m pip install --user dephell_versioning


Get available schemes, rules, and aliases:

from dephell_versioning import get_aliases, get_rules, get_schemes
# frozenset({'roman', 'pep', ..., 'comver'})

# frozenset({'local', 'minor', ..., 'dev', 'preminor'})

# frozenset({'alpha', 'rc', ..., 'micro', 'breaking'})

# get rules for some scheme:
# frozenset({'major', 'patch', 'init'})

# get aliases for specific rules:
get_aliases(rules={'major', 'minor'})
# frozenset({'feature', 'breaking'})

Bump version:

from dephell_versioning import bump_version

bump_version(version='1.2.3', rule='minor', scheme='semver')
# '1.3.0'

# pass aliase instead of rule:
bump_version(version='1.2.3', rule='feature', scheme='semver')
# '1.3.0'

# start rule from `+` to attach local version number:
bump_version(version='1.2.3', rule='+456', scheme='semver')
# '1.2.3+456'

# for `init` version is optional
bump_version(version='', rule='init', scheme='semver')
# '0.1.0'

Bump version in a python file:

from dephell_versioning import bump_file
from pathlib import Path

# returns `True` if version was bumped
bump_file(path=Path('dephell_versioning', ''), old='0.1.0', new='0.1.1')
# True

# old version is optional: any version will be bumped if old isn't found
bump_file(path=Path('dephell_versioning', ''), old='', new='0.1.2')
# True

Use dephell_discover to find out the current version in a python project:

from dephell_discover import Root
from pathlib import Path
root = Root(path=Path(), name='dephell_discover')

# root.metainfo can be None if project isn't found in the given directory
if root.metainfo:
# '0.1.2'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dephell-versioning, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size dephell_versioning-0.1.2-py3-none-any.whl (11.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dephell_versioning-0.1.2.tar.gz (9.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page