python-poetry / python-poetry/poetry
`poetry show --tree --only group_A` shows wrong tree when the same package has different extra dependencies in two different groups
Open
Nobody has claimed this yet.
kind/bug
status/triage
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided pyproject.toml using poetry show --tree --only b, then trace the poetry show --tree --only command entry point. Compare its tree selection with the correct flat output; done means group b shows only pydantic's decimal extra and does not include email-validator or its dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100