Generates next version number for your pyton package. If your package is a PYPI package it checks the latest version from PYPI and creates next version depending on your choices. Alternatively you may use local option which reads local __version__.py or any other file name you provide and creates the next version.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 next_version, Project, next_version_pypi, next_version_local
functions
next_version (general function both for pypi and local)
first checks PYPI if not then checks local
default parameters : pypi = True part = 'patch' => increments patch part of your version. Options : major/minor/patch/pre/build write = True => if True writes a new version file on your local path 'your_package_name/version.py' first makes a request to PYPI server to get information about your package then increments it depending on your choices If it is not a PYPI package or if pypi parameter is false checks local version file to increment
Usage example:
from verser import Project, next_version
from pathlib import Path
project = Project(package_name="evdspy",
default_version=default_vers,
version_file_path=Path() / "evdspy" / "__version__.py")
new_version = next_version(project, write=True, part='patch')
typically in your setup.py file you may use this variable like below
#file: setup.py
...
from verser import Project, next_version
from pathlib import Path
project = Project(package_name="evdspy",
default_version=default_vers,
version_file_path=Path() / "evdspy" / "__version__.py")
new_version = next_version(project, write=True, part='patch')
# the setup
setup(
name=f"{package_name}",
version=new_version,
description=f"{description}",
...
next_version_pypi (only for pypi packages)
new_version = next_version_pypi('rich')
print(new_version)
# results : 12.6.1
new_version = next_version_pypi('rich' , part = 'minor')
print(new_version)
# results : 12.7.0
next_version_local
it only checks local version.py file inside the root of your project creates one if does not exist
new_version = next_version_local(
package_name = 'some_cool_project_not_published' ,
increment_choice = True, => if selected False it will not increment current version
part = "minor" => it will increment minoır part of your package version
write = True , => since write is True it will rewrite current version to the version file
)
print(new_version)
# defaults
# --------next_version_pypi-------
# increment_choice = True , => if selected False it will not increment current version
# part='patch' => it will ignore this parameter
# write = True , => since write is True it will rewrite current version to the version file
Some examples
new_version = next_version_pypi('rich' , part='major')
new_version = next_version_pypi('rich' , part='patch')
new_version = next_version_pypi('rich' , part='major')
new_version = next_version_pypi('rich' , part='pre' , write=True )
new_version = next_version_pypi('rich' , part='build' , write=False )
new_version = next_version_local(
package_name = 'some_cool_package' ,
increment_choice = True
part = "minor"
write = True ,
)
new_version = next_version_local(
package_name = 'some_cool_package' ,
increment_choice = False
part = "patch"
write = True ,
)
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
Built Distribution
Hashes for verser-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f11fda5e5f81ed9e4aed5e89d117b1a7b2b00b5c9becf46b75a5c9063088c1a |
|
MD5 | 243329aee7aa207537f48617d71639e0 |
|
BLAKE2b-256 | 6b217018d9f5f906259db32ae3c08efc5e7c93b84ca10b3428ecd60f369ae071 |