Fix parenthesized PEP 508 requirements - #53
Open
andrew wants to merge 1 commit into
Open
Conversation
andrew
force-pushed
the
fix-pep508-parenthesized-requirements
branch
from
August 8, 2026 21:37
50ef9fe to
66aa020
Compare
There was a problem hiding this comment.
Pull request overview
Fixes parsing of PEP 508 dependency strings that wrap the version specifier in optional parentheses (e.g., requests (>=2.26,<3.0)), ensuring the package name and version constraint are extracted correctly and PURLs are generated without spurious ( / ) characters.
Changes:
- Update
parsePEP508to strip a trailing(from the extracted name and a trailing)from the extracted version constraint when the requirement uses parenthesized constraints. - Add unit tests for
parsePEP508covering parenthesized constraints (including extras and environment markers). - Add a regression fixture
pyproject.tomlplus an integration-level test asserting correct dependencyName,Version, andPURLoutput fromParse.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| testdata/pypi/pep508-parenthesized/pyproject.toml | Adds a PEP 621 dependencies fixture containing parenthesized version constraints (and one extras+marker case). |
| manifests_test.go | Adds regression test validating end-to-end parsing and PURL generation for the new fixture. |
| internal/pypi/pypi.go | Adjusts parsePEP508 to handle optional parentheses around version constraints. |
| internal/pypi/pypi_test.go | Extends unit tests for parsePEP508 and adds a benchmark covering representative inputs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #52.
Strip optional parentheses around PEP 508 version constraints without changing extras or environment marker handling.
Add regression fixtures covering the affected Poetry requirements.