Skip to content

Fix parenthesized PEP 508 requirements - #53

Open
andrew wants to merge 1 commit into
mainfrom
fix-pep508-parenthesized-requirements
Open

Fix parenthesized PEP 508 requirements#53
andrew wants to merge 1 commit into
mainfrom
fix-pep508-parenthesized-requirements

Conversation

@andrew

@andrew andrew commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

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.

@andrew
andrew force-pushed the fix-pep508-parenthesized-requirements branch from 50ef9fe to 66aa020 Compare August 8, 2026 21:37
@andrew
andrew requested a lite review from Copilot August 8, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parsePEP508 to 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 parsePEP508 covering parenthesized constraints (including extras and environment markers).
  • Add a regression fixture pyproject.toml plus an integration-level test asserting correct dependency Name, Version, and PURL output from Parse.

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.

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.

PEP 508 parenthesized requirements include opening parenthesis in package names

2 participants