Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Commit 61cf87a

Browse files
Copilotjpfeuffer
andcommitted
Address code review: improve version validation and lstrip usage
Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
1 parent 7ec8de9 commit 61cf87a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

docs/install_pyopenms.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ def get_version_from_rtd():
3939

4040
# If it looks like a version tag (e.g., "v3.5.0", "3.5.0"), use it directly
4141
# Strip leading 'v' if present
42-
version = rtd_version.lstrip('v')
42+
version = rtd_version[1:] if rtd_version.startswith('v') else rtd_version
43+
44+
# Validate that it looks like a version number (basic check)
45+
# Accept versions like "3.5.0", "3.5.0rc1", "3.5.0.dev1", etc.
46+
if not re.match(r'^\d+\.\d+', version):
47+
print(f"Warning: '{version}' does not look like a valid version, using 'latest'")
48+
return 'latest'
49+
4350
print(f"Using version from tag: {version}")
4451
return version
4552

0 commit comments

Comments
 (0)