Generates next version number for your pyton package. Creates version file and reads from the same path. It also provides useful functions to show your package's version at run time.
Project description
verser
from verser import Project, get_next_version, get_current_version
creates version.py file on your package's root
#__version__.py
#3.1.2.0
next_version = get_next_version(
project=Project("my_cool_project"),
increment_=True,
pre_release=False,
verbose=True
)
# pre_release : False, and increment_ True returns
# 3.1.2.0
# pre_release : True, and increment_ True returns
# 3.1.2.1rc1
# pre_release : True, and increment_ True returns
# 3.1.2.1rc2
# pre_release : False, and increment_ True returns
# 3.1.2.1
next version number for your project
project = Project(package_name="my_cool_package", default_version="0.0.0.0")
next_version = get_next_version(
project=project,
increment_=True,
pre_release=False,
verbose=True
)
print("Getting next version", next_version)
get_next_version (function)
gets current version of the project and increments depending on arguments given by developer...
@params
project : Project => see Project class which takes path to version file
------------
increment_ : bool => it may increment or return same version
------------
if True => depending on pre_release parameter creates new version number
if False => ignores pre_release parameter and just returns current version
pre_release : bool => creates next version by incrementin and adding "rc" text to the version
------------
(lets suppose current version is 0.0.1.2)
if True => creates a version like 0.0.1.3rc1
if False => creates a version like 0.0.1.3
verbose : bool
------------
verbose or silent while doing process
write_version_file : pathlib.Path or str
------------
if True : writes new version to given path
if False : does not write any file
now_testing: bool => default : False
------------
for testing purposes it plays with fake versions
this will be set True while testing development
get_current_version (function)
get_current_version
Read-only function
tries to find out current version of the file and returns.
@params
project : Project => see Project class which takes path to version file
verbose : bool
verbose or silent while doing process
write_version_file : pathlib.Path or str
if True : writes new version to given path
if False : does not write any file
test :
for testing purposes it plays with fake versions
Project (Class)
"""
Project (Class)
@attrs
package_name: str => package name
------------
default_version: str =>
------------
if there is not a version file yet this will be used to start a version number
default is : 0.0.0.0
(when incremented with function below it will be 0.0.0.1 or 0.0.0.1rc1 )
version_file_path: Union[str, Path] =>
------------
Version file address : this will be used to read current version
now_testing: bool => default : False
------------
this will be set True while testing development
"""
example usage
from verser import *
version = get_next_version(verbose=True,
project=Project(package_name="verser",
version_file_path=Path("__version__.py")
)
)
print(version)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for verser-0.0.0.18-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9cb99dbde73bb40ce8bf5d50d59625e6c5e857c3dc78ceea425fcee68dc6b1d |
|
MD5 | 266c5119916c0eabd5d381d0d9ec00b2 |
|
BLAKE2b-256 | 6f74552ba0a5defc7274d7ec09afcf7aa243ff65c2f2d57d8dd9bca75ad8cb98 |