dephell_versioning
Library for bumping project version.
Available schemes:
calvercomverpepromanromversemverserialzerover
Available rules (and aliases):
init-- initialize versioning- Main parts:
major(breaking)minor(feature)patch(fix,micro)
- Additional parts:
devlocalpost
- 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'
Metadata
Release files for dephell-versioning 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dephell_versioning-0.1.2.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dephell_versioning-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / dephell_versioning-0.1.2.tar.gz
| Download URL | dephell_versioning-0.1.2.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ba7636704af7bd64af5a64ab8efb482c8b0bf4868699722f5e2647763edf8e5
|
|
BLAKE2b-256 checksum How to use checksums |
70a2a84d89721fc35a05ae08388161f79eecfb1c6fab333f5a42eb4924968c47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
DepHell/0.8.3
|
Release files / dephell_versioning-0.1.2-py3-none-any.whl
| Download URL | dephell_versioning-0.1.2-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28f611bd3ec1644e3d6972f901b9aa67a1fe2ed3fe57566f82afd9c43f5a335a
|
|
BLAKE2b-256 checksum How to use checksums |
2999b45086363aee4a4136d277807c795394e66d63e1891d2164490fe745cb3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
DepHell/0.8.3
|