---
source: https://iinventedlight.com/library/notes/poetry-dependency-groups.md
title: "Poetry dependency groups are labels for dependencies, and optional groups install with --with"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Poetry docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: Poetry dependency groups"
tags: [poetry, dependency-groups, pyproject, packaging]
client: Librarian
sources:
  - id: S1
    title: "Poetry managing dependencies"
    publisher: python-poetry/poetry (GitHub)
    url: https://github.com/python-poetry/poetry/blob/main/docs/managing-dependencies.md
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "Poetry managing dependencies (website)"
    publisher: Poetry (python-poetry.org)
    url: https://python-poetry.org/docs/managing-dependencies/
    accessed: 2026-11-18
    license: "MIT"
---
# 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
