Package for a better version management in python projects


Keywords
git, describe, tags, version, SemVer
License
MIT
Install
pip install version-helper==0.3.1

Documentation

Version helper

version-helper is a package for a better version management in python projects.

This package is still under development. Code may change frequently.

PyPI PyPI - Python Version PyPI - Wheel codecov main Lines of code GitHub

from version_helper import Version
v = Version.get_from_git_describe()
print(v.core)  # major.minor.patch
print(v.full)  # major.minor.patch[-prerelease][+build]

Table of contents

Requirements

  • Python 3.6+
  • Git, if you'd need to receive a version string from git describe

Installing version-helper

pip install version-helper

Usage

Reading version from a file

import pathlib
from version_helper import Version

version = Version.read_from_file(
    file=pathlib.Path('/path/to/my/version_file.txt'),
    variable_name='APP_VERSION',
    separator='=',
)
print(version)

Writing version to a file

import pathlib
from version_helper import Version

version = Version(1, 2, 3)
version.write_to_file(
    file=pathlib.Path('/path/to/my/version_file.txt'),
    variable_name='APP_VERSION',
    separator='=',
)

Changelog

All notable changes to this project will be documented in the CHANGELOG.md.

References