poetry icon indicating copy to clipboard operation
poetry copied to clipboard

`poetry show --tree --only group_A` shows wrong tree when the same package has different extra dependencies in two different groups

Open vmgustavo opened this issue 9 months ago • 0 comments

Description

With this pyproject.toml:

[tool.poetry]
package-mode = false
version = "0.1.0"

[tool.poetry.dependencies]
python = "3.11.10"

[tool.poetry.group.dev.dependencies]

[tool.poetry.group.a.dependencies]
pydantic = {version = "^2.11.5", extras = ["email", "decimal"]}

[tool.poetry.group.b.dependencies]
pydantic = {version = "^2.11.5", extras = ["decimal"]}

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

When using poetry show --only b the output is correct:

annotated-types   0.7.0  Reusable constraint types to use with typing.Annotated
pydantic          2.11.5 Data validation using Python type hints
pydantic-core     2.33.2 Core functionality for Pydantic validation and serialization
typing-extensions 4.14.0 Backported and Experimental Type Hints for Python 3.9+
typing-inspection 0.4.1  Runtime typing introspection tools

But when using poetry show --tree --only b the output shows dependencies the the other extras (the email-validator):

pydantic 2.11.5 Data validation using Python type hints
├── annotated-types >=0.6.0
├── email-validator >=2.0.0
│   ├── dnspython >=2.0.0 
│   └── idna >=2.0.0 
├── pydantic-core 2.33.2
│   └── typing-extensions >=4.6.0,<4.7.0 || >4.7.0 
├── typing-extensions >=4.12.2
└── typing-inspection >=0.4.0
    └── typing-extensions >=4.12.0 

Workarounds

I don't know.

Poetry Installation Method

pipx

Operating System

Ubuntu 24

Poetry Version

Poetry (version 2.1.3)

Poetry Configuration

cache-dir = "/home/***/.cache/pypoetry"
data-dir = "/home/***/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = false
python.installation-dir = "{data-dir}/python"  # /home/***/.local/share/pypoetry/python
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/***/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml


Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

vmgustavo avatar Jun 03 '25 19:06 vmgustavo