From 6677e383b7007bb461bc611c69b1a1fbe530387d Mon Sep 17 00:00:00 2001 From: Vikrant Puppala Date: Tue, 21 Apr 2026 06:44:31 +0000 Subject: [PATCH] Fix dependency_manager: handle PEP 440 ~= compatible release syntax The _extract_versions_from_specifier function stripped a single `~` character from constraint strings, which corrupted PEP 440 compatible release syntax (`~=`) by leaving a stray `=`. For example, `thrift = "~=0.22.0"` produced the invalid constraint `thrift>==0.22.0,<=0.23.0`, breaking every PR's "Unit Tests (min deps)" job since #733 was merged. Add an explicit branch for `~=` that strips both characters before extracting the minimum version. The Poetry-style single `~` branch is preserved for backward compatibility. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala --- scripts/dependency_manager.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/dependency_manager.py b/scripts/dependency_manager.py index 15e119841..29c5fe828 100644 --- a/scripts/dependency_manager.py +++ b/scripts/dependency_manager.py @@ -69,16 +69,21 @@ def _parse_constraint(self, name, constraint): def _extract_versions_from_specifier(self, spec_set_str): """Extract minimum version from a specifier set""" try: - # Handle caret (^) and tilde (~) constraints that packaging doesn't support + # Handle caret (^) and tilde (~, ~=) constraints that packaging doesn't + # support (Poetry ^, Poetry ~, and PEP 440 ~=). if spec_set_str.startswith('^'): # ^1.2.3 means >=1.2.3, <2.0.0 min_version = spec_set_str[1:] # Remove ^ return min_version, None + elif spec_set_str.startswith('~='): + # PEP 440 compatible release: ~=1.2.3 means >=1.2.3, <1.3.0 + min_version = spec_set_str[2:] # Remove ~= + return min_version, None elif spec_set_str.startswith('~'): - # ~1.2.3 means >=1.2.3, <1.3.0 + # Poetry tilde: ~1.2.3 means >=1.2.3, <1.3.0 min_version = spec_set_str[1:] # Remove ~ return min_version, None - + spec_set = SpecifierSet(spec_set_str) min_version = None