Skip to content

Fix dependency_manager: handle PEP 440 ~= compatible release syntax#776

Merged
vikrantpuppala merged 1 commit intomainfrom
fix-dependency-manager-compat-release
Apr 21, 2026
Merged

Fix dependency_manager: handle PEP 440 ~= compatible release syntax#776
vikrantpuppala merged 1 commit intomainfrom
fix-dependency-manager-compat-release

Conversation

@vikrantpuppala
Copy link
Copy Markdown
Contributor

Summary

Fixes a bug in scripts/dependency_manager.py where PEP 440 compatible release syntax (~=) was incorrectly handled, breaking every PR's "Unit Tests (min deps)" job.

What broke

PR #733 ("Bump thrift to fix deprecation warning") changed pyproject.toml:

- thrift = ">=0.16.0,<0.21.0"
+ thrift = "~=0.22.0"

scripts/dependency_manager.py::_extract_versions_from_specifier had a branch for Poetry-style ~ (single tilde) that strips one character. When applied to ~=0.22.0, it left =0.22.0 (with stray =). The downstream _create_flexible_minimum_constraint then produced the invalid constraint:

thrift>==0.22.0,<=0.23.0

pip install rejects this with InvalidRequirement: Expected end or semicolon, failing every PR's min-deps install step.

Fix

Add an explicit branch for ~= that strips both characters before extracting the minimum version. The Poetry-style single ~ branch is preserved for backward compatibility.

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

How #733 got merged

PR #733 was merged with no CI checks reported on the branch — branch protection allowed the merge to bypass the unit test workflows that would have caught this. Worth investigating that separately.

Test plan

  • Generated min requirements locally before fix → thrift>==0.22.0,<=0.23.0 (invalid)
  • Generated min requirements locally after fix → thrift>=0.22.0,<0.23.0 (valid)
  • Verify CI's Unit Tests (min deps) jobs pass on this PR

NO_CHANGELOG=true

This pull request was AI-assisted by Isaac.

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 <vikrant.puppala@databricks.com>
@vikrantpuppala vikrantpuppala merged commit b088a35 into main Apr 21, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants