Class to manage semantic versioning
Project description
Version-Tools
Installation
From Repository
To install the Version-Tools package from the repository, run the following commands:
git clone https://github.com/RomoloPoliti-INAF/version-tools.git
cd version-tools
poetry install
From PyPi
To install the Version-Tools package from PyPi, run the following command:
pip install semantic-version-tools
Using poetry
To add the package to your poetry project, you can run the command:
poetry add semantic-versioning-tools
Usage
To use the library it's necessary import the class Vers, than you can comapare or manipulate the version numbers.
Initialize and print version
>>> from semantic_version_tools import Vers
>>> main_ver=Vers('1.0')
>>> print(main_ver)
Version 1.0
The version number could be a string or a tuple, whit 2 or 5 elements:
- the major version number
- the minor version number
- the patch number
- pre-release type
- build number
For the pre-release are used letters as reported below:
- d: developing version
- a: alpha release
- b: beta release
- rc: release candidate
- f: final release
>>> main_version = Vers((0,1,0,'d',1))
>>> print(main_version)
Version 0.1.0-devel.1
>>> main_version = Vers('0.1.0-a.1')
>>> print(main_version)
Version 0.1.0-alpha.1
Compare versions
In the class Vers are implemented the main comparison operators. For example:
>>> a=Vers('1.0.0')
>>> b=Vers('1.0.1')
>>> a>b
False
>>> a==b
False
>>> a<b
True
a<=b
True
Sum and increase
It's possible sum tro version number or icrease it.
>>> a = Vers('1.0.0')
>>> b = Vers('1.0.1')
>>> c=a+b
>>> c
Version 2.0.1
>>> a = Vers('1.0.0')
>>> a=a+1
>>> a
Version 1.1.0
# equivalent to
>>> a +=1
>>> a
Version 1.1.0
The summ add a minor version. To add a major version you must add a float
>>> a = Vers('1.0.0')
>>> a += 1.0
>>> a
Version 2.0.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semantic_version_tools-1.4.1.tar.gz.
File metadata
- Download URL: semantic_version_tools-1.4.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.1 CPython/3.14.2 Linux/6.18.5-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
301c072a1942cdc96cf2ac8cfffaa398992765b63168140c7d7f119b74e2e231
|
|
| MD5 |
7fba002e3bfc5ffd8545f399d3ed1d07
|
|
| BLAKE2b-256 |
cac86940184c1d2bad1de17fdad56563505b37bac0560c41c3229baf55633094
|
File details
Details for the file semantic_version_tools-1.4.1-py3-none-any.whl.
File metadata
- Download URL: semantic_version_tools-1.4.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.1 CPython/3.14.2 Linux/6.18.5-200.fc43.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02e3806f3ccb213698f011799c1fded2fa20b7f5fb680e529829090a0d3b940b
|
|
| MD5 |
d4b0b4f638f7c51884ab1987c9e7bc42
|
|
| BLAKE2b-256 |
ee9dccf2a6da81417385ebff5ab2eddc82a5af5e37a0a7ba7250f980397909b3
|