Skip to content

Commit e9a78d7

Browse files
Address Copilot PR review comments: fix version constraint parsing
1 parent 8598a60 commit e9a78d7

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

libraries/microsoft-agents-a365-tooling/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ license = {text = "MIT"}
2525
dependencies = [
2626
"pydantic >= 2.0.0",
2727
"typing-extensions >= 4.0.0",
28-
"microsoft-agents-hosting-core >= 0.7.0",
28+
"microsoft-agents-hosting-core >= 0.4.0",
2929
]
3030

3131
[project.urls]

tests/test_dependency_constraints.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ def parse_version_constraint(constraint: str) -> dict:
6666
Examples:
6767
">= 0.4.0, < 0.6.0" -> {"lower": "0.4.0", "upper": "0.6.0", "upper_inclusive": False}
6868
">= 0.4.0" -> {"lower": "0.4.0", "upper": None}
69+
70+
Note: Supports version numbers with any number of parts (e.g., "1.0", "1.0.0", "1.0.0.0").
6971
"""
7072
result = {"lower": None, "upper": None, "upper_inclusive": False, "raw": constraint}
7173

72-
# Match upper bound patterns: < X.Y.Z or <= X.Y.Z
73-
upper_match = re.search(r"<\s*=?\s*(\d+\.\d+\.\d+)", constraint)
74+
# Match upper bound patterns: < X.Y or <= X.Y.Z (any dotted numeric version)
75+
upper_match = re.search(r"(<\s*=?)\s*(\d+(?:\.\d+)*)", constraint)
7476
if upper_match:
75-
result["upper"] = upper_match.group(1)
76-
result["upper_inclusive"] = "<=" in constraint[: upper_match.start() + 2]
77+
result["upper"] = upper_match.group(2)
78+
result["upper_inclusive"] = upper_match.group(1).replace(" ", "") == "<="
7779

78-
# Match lower bound patterns: >= X.Y.Z or > X.Y.Z
79-
lower_match = re.search(r">=?\s*(\d+\.\d+\.\d+)", constraint)
80+
# Match lower bound patterns: >= X.Y or > X.Y.Z (any dotted numeric version)
81+
lower_match = re.search(r">=?\s*(\d+(?:\.\d+)*)", constraint)
8082
if lower_match:
8183
result["lower"] = lower_match.group(1)
8284

0 commit comments

Comments
 (0)