Skip to content

AST-146437: Enhance PyPI parser for all Python dependency formats#18

Open
cx-sumit-morchhale wants to merge 4 commits intomainfrom
feature/AST-146437-PyPI-upgradeSup
Open

AST-146437: Enhance PyPI parser for all Python dependency formats#18
cx-sumit-morchhale wants to merge 4 commits intomainfrom
feature/AST-146437-PyPI-upgradeSup

Conversation

@cx-sumit-morchhale
Copy link
Copy Markdown

Summary

  • Line continuations & hashes: Support \ line continuations and --hash=sha256:... options used by pip-compile, pip-tools, uv export, and Poetry export
  • New content formats: URL requirements (pkg @ https://...), VCS requirements (git+, hg+, svn+, bzr+ with #egg=), === arbitrary equality operator, pip CLI options skipping (-i, -r, -c, -e, -f, etc.)
  • New file pattern: constraints.txt / constraints-*.txt now routes to PyPI parser
  • Comprehensive test coverage: 15 new parser tests + 8 new selector tests + 3 test fixtures (uv export, pip-freeze, pip-compile)

Files Changed

File Change
internal/parsers/pypi/pypi-parser.go Enhanced parser with preprocessing, VCS/URL/=== support
internal/parsers/pypi/pypi-parser_test.go +15 new test cases
pkg/parser/manifest-file-selector.go Added constraints.txt pattern
pkg/parser/manifest-file-selector_test.go +8 new selector tests
internal/testdata/requirements-uv-export.txt New fixture: uv export format
internal/testdata/requirements-pip-freeze.txt New fixture: pip freeze format
internal/testdata/requirements-pip-compile.txt New fixture: pip-compile format

Test plan

  • All 20 PyPI parser tests pass (5 existing + 15 new)
  • All 15 selector tests pass (7 existing + 8 new)
  • Zero regressions: verified by running tests on original main branch — identical results
  • npm parser tests unaffected

🤖 Generated with Claude Code

…cy formats

- Add line continuation (\) support for pip-compile, pip-tools, uv export formats
- Add --hash= option stripping for hashed requirements
- Add pip CLI option skipping (-i, -r, -c, -e, -f, --index-url, etc.)
- Add === arbitrary equality version operator support
- Add URL requirement parsing (PEP 508: pkg @ https://...)
- Add VCS requirement parsing (git+, hg+, svn+, bzr+ with #egg=)
- Add constraints.txt / constraints-*.txt file pattern support
- Add 15 new unit tests covering all new formats and edge cases
- Add 8 new selector tests for file pattern matching
- Add test fixtures for uv export, pip-freeze, and pip-compile formats
- Zero regressions: all existing tests continue to pass

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Logo
Checkmarx One – Scan Summary & Detailsee17da4a-e5e3-4e32-a66a-844c806fce15

Great job! No new security vulnerabilities introduced in this pull request

cx-sumit-morchhale and others added 3 commits April 14, 2026 00:41
Update all test fixture files and inline test content to use
non-vulnerable package versions:
- asgiref 3.7.2 → 3.8.1
- django 4.2.4 → 5.1.7
- pycryptodome 3.18.0 → 3.21.0
- sqlparse 0.4.2/0.4.4 → 0.5.3
- typing-extensions 4.7.1 → 4.12.2
- flask 2.0.1 → 3.1.0
- requests 2.28.0 → 2.32.3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Relocate requirements-uv-export.txt, requirements-pip-freeze.txt,
and requirements-pip-compile.txt to test/resources to follow existing
project convention. Update test file paths accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Django 5.1.7 → 5.2.13 (5.1 is EOL, 5.2.13 is latest LTS security release)
- sqlparse 0.5.3 → 0.5.5 (latest stable with security fixes)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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