python-poetry / python-poetry/poetry

Poetry interactive add should show optional dependencies when one is given

Open
#4,360 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 documentation and believe that my question is not covered.

Feature Request

Running poetry init and using the interactive dependency search should show the name of the extra package next to the package name. Currently only the package name is shown (giving no indication of if the extra is correct or not).

Ex. adding requests[security]:

Search for package to add (or leave blank to continue): requests[security]
Found 20 packages matching requests[security]

Enter package # to add, or the complete package name if it is not listed:
 [0] requests
 [1] requests5
 [2] requests2
...
 >

Here only requests is shown. It would be great if it showed requests[security]:

Search for package to add (or leave blank to continue): requests[security]
Found 20 packages matching requests[security]

Enter package # to add, or the complete package name if it is not listed:
 [0] requests[security]

Potentially related: https://github.com/pypa/pip/issues/3797

Similarly, detect package extras that don't exist. I.e. in the example below, poetry will just happily add some dependency which will never actually be able to be installed:

Add a package: requests[doesnotexist]
Found 20 packages matching requests[doesnotexist]

Enter package # to add, or the complete package name if it is not listed:
 [0] requests
 [1] requests5
 [2] requests2

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 with the interactive dependency search used by poetry init, focusing on how entered package names are matched and displayed. Verify that an extra such as requests[security] remains visible in the selection and that an invalid extra such as requests[doesnotexist] is detected rather than accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.