Poetry dependency groups are labels for dependencies, and optional groups install with --with
Answer: Poetry lets you split dependencies into groups. Declare a group with a PEP 735 dependency-groups table, or with tool.poetry.group.<group>. A group can be optional, and then you install it with --with.
Declaring a group
The implicit group is main.
Optional groups
An optional group is skipped in a default install. poetry install --with test adds that group. Optional group dependencies are still resolved with the rest of the lock set, so they must be compatible.
Claims
- id: C1 claim: A new group can be declared with dependency-groups or tool.poetry.group. source: S1 evidence: "To declare a new dependency group"
- id: C2 claim: Optional groups install in addition to default dependencies with --with. source: S1 evidence: "Optional groups can be installed in addition to the default dependencies by using the
--with"
- id: C3 claim: The website documents the same group declaration. source: S2 evidence: "dependency group"
- id: C4 claim: The website also documents optional groups and --with. source: S2 evidence: "--with"
Sources
- [S1] Poetry managing dependencies. python-poetry/poetry (GitHub). https://github.com/python-poetry/poetry/blob/main/docs/managing-dependencies.md . License: MIT. Accessed 2026-11-18.
- [S2] Poetry managing dependencies (website). Poetry (python-poetry.org). https://python-poetry.org/docs/managing-dependencies/ . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: python-poetry/poetry (GitHub), Poetry managing dependencies, MIT (https://raw.githubusercontent.com/python-poetry/poetry/main/LICENSE); Poetry (python-poetry.org), Poetry managing dependencies (website), MIT (https://raw.githubusercontent.com/python-poetry/poetry/main/LICENSE). Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: python-poetry/poetry (GitHub), Poetry managing dependencies, MIT (https://raw.githubusercontent.com/python-poetry/poetry/main/LICENSE); Poetry (python-poetry.org), Poetry managing dependencies (website), MIT (https://raw.githubusercontent.com/python-poetry/poetry/main/LICENSE).
Cite this
iinventedlight. 2026. "Poetry dependency groups are labels for dependencies, and optional groups install with --with." iinventedlight Library, iil:note:g32qbcqf, version of 2026-11-18. https://iinventedlight.com/library/notes/poetry-dependency-groups/. License: CC-BY-4.0.
@misc{iil_note_g32qbcqf,
author = {{iinventedlight}},
title = {{Poetry dependency groups are labels for dependencies, and optional groups install with --with}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/poetry-dependency-groups/},
note = {Permanent ID iil:note:g32qbcqf. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/poetry-dependency-groups.md.