semantic-version-tools 1.3.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- semantic_version_tools-1.3.1/PKG-INFO +11 -0
- {semantic_version_tools-1.3.0 → semantic_version_tools-1.3.1}/pyproject.toml +12 -4
- semantic_version_tools-1.3.1/src/semantic_version_tools/__init__.py +1 -0
- {semantic_version_tools-1.3.0/src/version_tools → semantic_version_tools-1.3.1/src/semantic_version_tools}/version.py +31 -17
- semantic_version_tools-1.3.0/PKG-INFO +0 -38
- semantic_version_tools-1.3.0/README.md +0 -22
- semantic_version_tools-1.3.0/src/version_tools/__init__.py +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: semantic-version-tools
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: Class to manage semantic versioning
|
|
5
|
+
Author: Romolo Politi
|
|
6
|
+
Author-email: romolo.politi@inaf.it
|
|
7
|
+
Requires-Python: >=3.10,<3.14
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "semantic-version-tools"
|
|
3
|
-
version = "1.3.
|
|
4
|
-
description = ""
|
|
3
|
+
version = "1.3.1"
|
|
4
|
+
description = "Class to manage semantic versioning"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Romolo Politi",email = "romolo.politi@inaf.it"}
|
|
7
7
|
]
|
|
8
8
|
readme = "README.md"
|
|
9
|
-
requires-python = ">=3.10, <3.14"
|
|
10
9
|
dependencies = [
|
|
11
10
|
"setuptools (>=75.8.0,<76.0.0)"
|
|
12
11
|
]
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
[tool.poetry]
|
|
16
|
-
packages = [{include = "
|
|
15
|
+
packages = [{include = "semantic_version_tools", from = "src"}]
|
|
17
16
|
include = ["CHANGELOG.md"]
|
|
17
|
+
name="semantic-version-tools"
|
|
18
|
+
version="1.3.1"
|
|
19
|
+
description="Class to manage semantic versioning"
|
|
20
|
+
authors = [
|
|
21
|
+
"Romolo Politi <romolo.politi@inaf.it>"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.poetry.dependencies]
|
|
25
|
+
python = ">=3.10, <3.14"
|
|
18
26
|
|
|
19
27
|
|
|
20
28
|
[tool.poetry.group.dev.dependencies]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from semantic_version_tools.version import Vers
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import re
|
|
3
3
|
from importlib.metadata import version
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
###################################
|
|
6
7
|
# Versioning Class
|
|
7
8
|
###################################
|
|
@@ -11,16 +12,9 @@ from importlib.metadata import version
|
|
|
11
12
|
#
|
|
12
13
|
# The versioning is based on the Semantic Versioning 2.0.0
|
|
13
14
|
#
|
|
14
|
-
# History:
|
|
15
|
-
#
|
|
16
|
-
# 2025-02-25: Moved to standalone module (1.3.0)
|
|
17
|
-
# 2024-11-18: accept string as imput (1.2.0)
|
|
18
|
-
# 2024-10-04: The patch is now not mandatory (1.1.0)
|
|
19
|
-
# 2021-09-07: First implementation of the class (1.0.0)
|
|
20
15
|
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
__version__ = version('version_tools')
|
|
17
|
+
__version__ = version('semantic_version_tools')
|
|
24
18
|
|
|
25
19
|
code = {"d": "devel", "a": "alpha", "b": "beta", "rc": "ReleaseCandidate", "f": "Final"}
|
|
26
20
|
|
|
@@ -47,12 +41,15 @@ class Vers:
|
|
|
47
41
|
"""
|
|
48
42
|
|
|
49
43
|
def __init__(self, ver: tuple | str) -> None:
|
|
44
|
+
|
|
50
45
|
if isinstance(ver, str):
|
|
51
46
|
a = re.match(
|
|
52
47
|
r"(\d+)\.(\d+)(?:\.(\d+))?(?:[-\.]([a-zA-Z]*)(?:\.?(\d+))?)?", ver
|
|
53
48
|
)
|
|
54
49
|
prt = list(a.groups())
|
|
55
|
-
prt[0:
|
|
50
|
+
prt[0:2] = [int(i) for i in prt[0:2]]
|
|
51
|
+
if prt[2] is not None:
|
|
52
|
+
prt[2] = int(prt[2])
|
|
56
53
|
if prt[3] is not None:
|
|
57
54
|
if prt[3].lower() in "development":
|
|
58
55
|
prt[3] = "d"
|
|
@@ -65,12 +62,14 @@ class Vers:
|
|
|
65
62
|
elif prt[3].lower() in "final":
|
|
66
63
|
prt[3] = "f"
|
|
67
64
|
else:
|
|
68
|
-
prt[3] =
|
|
65
|
+
prt[3] = None
|
|
69
66
|
if prt[3] is not None and prt[4] is None:
|
|
70
|
-
prt[4] =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
prt[4] = None
|
|
68
|
+
else:
|
|
69
|
+
if prt[3] is not None:
|
|
70
|
+
prt[4] = int(prt[4])
|
|
71
|
+
ver = tuple([x for x in prt if x is not None])
|
|
72
|
+
# print(ver)
|
|
74
73
|
self._len = 3
|
|
75
74
|
if len(ver) < 3:
|
|
76
75
|
self.major, self.minor, *extra = ver
|
|
@@ -79,7 +78,7 @@ class Vers:
|
|
|
79
78
|
else:
|
|
80
79
|
self.major, self.minor, self.patch, *extra = ver
|
|
81
80
|
# self.patch = extra[0] if extra else None
|
|
82
|
-
self.type = extra[0] if len(extra) != 0 else
|
|
81
|
+
self.type = extra[0] if len(extra) != 0 else 'f'
|
|
83
82
|
if self.type is not None:
|
|
84
83
|
if not isinstance(self.type, str):
|
|
85
84
|
raise Exception(
|
|
@@ -90,7 +89,7 @@ class Vers:
|
|
|
90
89
|
f"the fourth element of the version mus be one of {
|
|
91
90
|
','.join(code.keys())}"
|
|
92
91
|
)
|
|
93
|
-
self.build = extra[1] if len(extra) > 1 else
|
|
92
|
+
self.build = extra[1] if len(extra) > 1 else 1
|
|
94
93
|
|
|
95
94
|
def full(self) -> str:
|
|
96
95
|
"""
|
|
@@ -180,5 +179,20 @@ class Vers:
|
|
|
180
179
|
else:
|
|
181
180
|
return False
|
|
182
181
|
|
|
183
|
-
|
|
182
|
+
def __add__(self, other:"Vers") -> "Vers":
|
|
183
|
+
|
|
184
|
+
if isinstance(other,int):
|
|
185
|
+
self.minor += other
|
|
186
|
+
|
|
187
|
+
if isinstance(other,float):
|
|
188
|
+
a=str(other).split(".")
|
|
189
|
+
self.major += int(a[0])
|
|
190
|
+
self.minor += int(a[1])
|
|
191
|
+
|
|
192
|
+
if isinstance(other, Vers):
|
|
193
|
+
self.major += other.major
|
|
194
|
+
self.minor += other.minor
|
|
195
|
+
if self._len == 3:
|
|
196
|
+
self.patch += other.patch
|
|
197
|
+
return self
|
|
184
198
|
# version = Vers(VERSION)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: semantic-version-tools
|
|
3
|
-
Version: 1.3.0
|
|
4
|
-
Summary:
|
|
5
|
-
Author: Romolo Politi
|
|
6
|
-
Author-email: romolo.politi@inaf.it
|
|
7
|
-
Requires-Python: >=3.10, <3.14
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Requires-Dist: setuptools (>=75.8.0,<76.0.0)
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Version-Tools
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
### From Repository
|
|
22
|
-
|
|
23
|
-
To install the Version-Tools package from the repository, run the following commands:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
git clone https://github.com/RomoloPoliti-INAF/version-tools.git
|
|
27
|
-
cd version-tools
|
|
28
|
-
poetry install
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### From PyPi
|
|
32
|
-
|
|
33
|
-
To install the Version-Tools package from PyPi, run the following command:
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
pip install version-tools
|
|
37
|
-
```
|
|
38
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# Version-Tools
|
|
3
|
-
|
|
4
|
-
## Installation
|
|
5
|
-
|
|
6
|
-
### From Repository
|
|
7
|
-
|
|
8
|
-
To install the Version-Tools package from the repository, run the following commands:
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
git clone https://github.com/RomoloPoliti-INAF/version-tools.git
|
|
12
|
-
cd version-tools
|
|
13
|
-
poetry install
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### From PyPi
|
|
17
|
-
|
|
18
|
-
To install the Version-Tools package from PyPi, run the following command:
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
pip install version-tools
|
|
22
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from version_tools.version import Vers
|