Skip to content

[pysrc2cpg] Expand dependency resolution and import resolution#5912

Open
allsmog wants to merge 1 commit intojoernio:masterfrom
allsmog:py/expand-deps-and-imports
Open

[pysrc2cpg] Expand dependency resolution and import resolution#5912
allsmog wants to merge 1 commit intojoernio:masterfrom
allsmog:py/expand-deps-and-imports

Conversation

@allsmog
Copy link
Copy Markdown

@allsmog allsmog commented Mar 30, 2026

Expands Python dependency and import resolution beyond basic requirements.txt.

  • Support pyproject.toml (PEP 621 and Poetry formats) for dependency parsing
  • Support setup.cfg install_requires for dependency parsing
  • Support flexible version specifiers (>=, <=, ~=, !=, etc.) in requirements.txt
  • Handle extras, environment markers, comments, and bare package names
  • Add init.py package import support
  • Add star import expansion via module cache lookup

Test plan

  • New DependencyPassTests: requirements.txt, pyproject.toml (PEP 621 + Poetry), setup.cfg
  • New PythonImportResolverPassTests: init.py imports, star import expansion, external fallback
  • All existing pysrc2cpg tests pass

- Support pyproject.toml (PEP 621 and Poetry) and setup.cfg for dependency parsing
- Support flexible version specifiers (>=, <=, ~=, etc.) in requirements.txt
- Add __init__.py package import support
- Add star import expansion via module cache lookup
Copy link
Copy Markdown
Contributor

@ml86 ml86 left a comment

Choose a reason for hiding this comment

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

Handling further kinds of dependency defining formats is fine from my side.

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.

2 participants