Skip to content

add Poetry grapher#14362

Draft
jakecoffman wants to merge 7 commits intomainfrom
copilot/add-grapher-subclass-poetry
Draft

add Poetry grapher#14362
jakecoffman wants to merge 7 commits intomainfrom
copilot/add-grapher-subclass-poetry

Conversation

@jakecoffman
Copy link
Member

What are you trying to accomplish?

Providing more robust information to Dependency Graph for the Poetry package manager.

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

We'll test it on repos!

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

Copilot AI and others added 5 commits March 4, 2026 19:05
Create a DependencyGrapher subclass for the Poetry package manager that:
- Parses poetry.lock to extract dependency relationships
- Handles the Poetry TOML lockfile format where dependencies are
  a hash of name to version constraint
- Falls back to empty relationships when no lockfile is present
- Registers as the grapher for the 'pip' package manager

Includes test fixtures and specs following the UV grapher PR pattern.

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
When poetry.lock is missing or fails to parse, fall back to running
`poetry show --tree` to extract dependency relationships, mirroring
the UV grapher's fallback to `uv tree`.

Also adds `run_in_parsed_context` to Python FileParser to enable
running shell commands in a temporary directory with dependency files.

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
- Extract duplicate regex pattern into TREE_DEPTH_SEGMENT constant
- Use endless range syntax for array truncation

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
Copilot AI and others added 2 commits March 4, 2026 20:30
Only attempt `poetry show --tree` when the project has [tool.poetry]
in pyproject.toml or uses poetry.core build backend. Non-Poetry
projects (plain pip, pipenv, pip-compile) now return empty
relationships instead of failing.

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
Remove poetry show --tree fallback, tree parsing code, and
poetry_project? detection. Just parse poetry.lock if present,
otherwise return empty relationships. Non-Poetry projects are
handled naturally since they won't have a poetry.lock.

Co-authored-by: jakecoffman <886768+jakecoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants