python-poetry / python-poetry/poetry

Feature request: activate extras in group dependencies

Open
#8,279 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Hello! I cannot believe someone did not ask it before, but I really couldn't find, so here is my question / feature question: is it possible to activate extra dependencies in groups?

To my knowledge, it seems like it is not possible, but I would love to see this feature (but maybe this is not possible due to how pip and Poetry are implemented).

Example

Let say a have some package with extras dependencies. I also have a test group, that must activate all extras since I want to test the main package with all its features.

[tool.poetry.dependencies]
a = "1"
b = {version = "1", optional = true}

[tool.poetry.extras]
extra-feature = ["b"]

[tool.poetry.group]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "1"
b = "1"

Instead of duplicating all my extra dependencies, I'd love to just say that group test needs extra-feature.

For example:

[tool.poetry.dependencies]
a = "1"
b = {version = "1", optional = true}

[tool.poetry.extras]
extra-feature = ["b"]

[tool.poetry.group]
optional = true
extras = ["extra-feature"]

[tool.poetry.group.test.dependencies]
pytest = "1"

For people that know, Rust actually does that (extras are called features) very well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how Poetry represents dependency groups and extras, then inspect the related dependency-resolution and packaging tests. Compare the proposed group configuration with the existing TOML behavior and define how activating an extra through a group should affect resolution and installation. Done means the behavior is specified, implemented, and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.