← All notes

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

Sources

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

Permanent ID: iil:note:g32qbcqf

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.},
}

Markdown

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.