Skip to content

fix: handle ~= and != version operators in Python dependency name parsing#1

Closed
a-oren wants to merge 1 commit into
mainfrom
TC-4041
Closed

fix: handle ~= and != version operators in Python dependency name parsing#1
a-oren wants to merge 1 commit into
mainfrom
TC-4041

Conversation

@a-oren
Copy link
Copy Markdown
Owner

@a-oren a-oren commented Apr 29, 2026

Summary

  • Fix getDependencyName() to recognize ~ and ! as PEP 508 version operator characters, preventing them from being included in the package name (e.g. urllib3~=1.26.0 was parsed as package urllib3~ instead of urllib3)
  • Replace the fragile three-index getFirstSign() approach with a simple loop over all PEP 508 operator characters (>, <, =, ~, !)
  • Add unit tests for compatibility (~=) and exclusion (!=) operators, including combined extras + special operators

Implements TC-4041

Test plan

  • All 358 existing unit tests pass
  • New unit tests verify ~= and != parsing
  • Manual CLI test with example requirements.txt from the ticket produces correct SBOM

🤖 Generated with Claude Code

…sing

getDependencyName() only recognized >, <, and = as version operator
characters, causing ~ from ~= (compatibility) and ! from != (exclusion)
to be included in the package name (e.g. "urllib3~", "click!").

Replaced the three-index approach with a loop that recognizes all PEP 508
version operator characters (>, <, =, ~, !).

Fixes TC-4041

Assisted-by: Claude Code
@github-actions
Copy link
Copy Markdown

Test Results

453 tests   451 ✅  1m 14s ⏱️
 30 suites    2 💤
 30 files      0 ❌

Results for commit d897b3c.

@a-oren a-oren closed this Apr 29, 2026
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.

1 participant