Skip to main content

Library for bumping project version like a pro

Project description

dephell_versioning

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.

Installation

install from PyPI:

python3 -m pip install --user dephell_versioning

Usage

Get available schemes, rules, and aliases:

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

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

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

# get rules for some scheme:
get_rules(scheme='calver')
# 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', '__init__.py'), 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', '__init__.py'), 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:
    print(root.metainfo.version)
# '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.

Source Distribution

dephell_versioning-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

dephell_versioning-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file dephell_versioning-0.1.0.tar.gz.

File metadata

  • Download URL: dephell_versioning-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for dephell_versioning-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea0d97e7ecdbce503afb90fd14430b4c88924047e004f6060eeb5699d1746330
MD5 1561fac871769960055b77f90d9f6c0c
BLAKE2b-256 fe3168627152a66a7a03ca30314938661c5951a301154e7544802bb47572454d

See more details on using hashes here.

File details

Details for the file dephell_versioning-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dephell_versioning-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for dephell_versioning-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b771376fff5096568dfe49776b033ef46bd3ead16a31db7da7c6618d6c1d2dfb
MD5 7db6777d3bd7534418dc1e13f394d7e8
BLAKE2b-256 7ee3f150c4eb40f8d157e9e8544e8858654be320411f95a8d3a852349b394319

See more details on using hashes here.

Supported by

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