Skip to content

Make poetry show <package> --tree show who requires <package> as well #5396

@jacopok

Description

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

Feature Request

Consider a project with pyproject.toml reading:

[tool.poetry]
name = "my_package"
version = "0.1.0"
description = ""
authors = ["Me <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.8, <3.11"

[tool.poetry.dev-dependencies]
pytest = "^7.1.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

The full dependencies, as shown by poetry show --tree, are

$ poetry show --tree
pytest 7.1.1 pytest: simple powerful testing with Python
├── atomicwrites >=1.0
├── attrs >=19.2.0
├── colorama *
├── iniconfig *
├── packaging *
│   └── pyparsing >=2.0.2,<3.0.5 || >3.0.5 
├── pluggy >=0.12,<2.0
├── py >=1.8.2
└── tomli >=1.0.0

For larger projects, it can be helpful to find out which package is requiring another:
for example, say I want to figure out which of my top-level dependencies is requiring packaging.

Currently (poetry version 1.1.13) the behaviour of poetry show packaging --tree is:

$ poetry show packaging --tree
packaging 21.3 Core utilities for Python packages
└── pyparsing >=2.0.2,<3.0.5 || >3.0.5

So, it doesn't tell me that it is pytest which is asking for packaging to be present;
however this information is available as the full output shows.
I'm proposing that the output could look something like:

$ poetry show packaging --tree
pytest 7.1.1
├── packaging (required: *, used: 21.3) Core utilities for Python packages
│   └── pyparsing >=2.0.2,<3.0.5 || >3.0.5 

and so on for all the packages which require the one on hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions