python-poetry / python-poetry/poetry

`poetry show $DEPENDENCY` should also list the user defined dependencies that cause the inclusion of this `$DEPENDENCY`

Open
#8,975 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/show kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Running poetry show with a particular dependency only shows the parent dependencies that require it, instead of showing the dependencies defined by the user in the pyproject.toml that introduced it.

For example, I would like to know why my package depends on aiohttp. Running poetry show aiohttp shows that datasets and ffspec require it, but I did not directly add those dependencies to my project, and they don't tell me too much about why aiohttp is in my project:

image

It would be very useful if it actually returned the packages that I explicitly included (flair, transformers, and a few more).

I created this workaround where I parse the result of poetry show --tree in order to get this information:
https://gist.github.com/nicolassanmar/ed7f2a0dcccb5fab21364d86ec960444

poetry show aiohttp --why --tree does not show top-level dependencies either

None of the options for the poetry show command actually acomplish what I want to do.

image

datasets is not defined in my top-level packages (neither is ffspec):
image

Related context:
This is the PR that added the option to poetry show on a dependency https://github.com/python-poetry/poetry/pull/2351

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the poetry show <dependency> command and the behavior introduced in PR #2351; compare its current --why and --tree output with top-level entries in pyproject.toml. Done means the command identifies user-declared packages that introduce the requested dependency, including the demonstrated case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.