From 4a52a71956a8d46fcb7294ac71734504bb09bcc2 Mon Sep 17 00:00:00 2001 From: S. Solomon Darnell Date: Fri, 28 Mar 2025 21:52:21 -0500 Subject: two version of R2R are here --- .../python3.12/site-packages/hatchet_sdk/semver.py | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .venv/lib/python3.12/site-packages/hatchet_sdk/semver.py (limited to '.venv/lib/python3.12/site-packages/hatchet_sdk/semver.py') 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 -- cgit v1.2.3