about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py')
-rw-r--r--.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py b/.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py
new file mode 100644
index 00000000..4bb9aa4f
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py
@@ -0,0 +1,30 @@
+def bump_minor_version(version: str) -> str:
+    """
+    Bumps the minor version of a semantic version string. NOTE this doesn't follow full semver,
+    missing the build metadata and pre-release version.
+
+    :param version: A semantic version string in the format major.minor.patch
+    :return: A string with the minor version bumped and patch version reset to 0
+    :raises ValueError: If the input is not a valid semantic version string
+    """
+    # if it starts with a v, remove it
+    had_v = False
+    if version.startswith("v"):
+        version = version[1:]
+        had_v = True
+
+    parts = version.split(".")
+    if len(parts) != 3:
+        raise ValueError(f"Invalid semantic version: {version}")
+
+    try:
+        major, minor, _ = map(int, parts)
+    except ValueError:
+        raise ValueError(f"Invalid semantic version: {version}")
+
+    new_minor = minor + 1
+    new_version = f"{major}.{new_minor}.0"
+
+    if had_v:
+        new_version = "v" + new_version
+    return new_version