python-poetry / python-poetry/poetry

Improve the keyboard interface of the init command

Open
#8,023 2 comments 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

While Poetry is an awesome tool, I've found that running through the poetry init command can be very frustrating tedious for a few reasons, all due to the poor handling of user input and some poor UI choices.

There are a multitude of improvements that I can think of

  • If I make a typo at the start of a long string (such as a description), I can't use my arrow keys or the home key to navigate backwards in the string. Instead I need to delete all of my typing and type it out again. Poetry should handle these extra keys so that it is possible to edit input effectively.

  • If I make a typo in the look-up of a dependency that leads to my desired package not being listed, it seems like there is no way to correct it - typing the corrected name of the package gives an error. While it is possible to leave it blank and type typing it again, this is not made clear by the UI.

  • Once I am shown the preview of the output, there is no opportunity to go back through the information I've entered and tweak any mistakes. For example, if I realise I forgot a dependency once I'm up to defining dev dependencies, I just need to remember to install it later.

  • In my opinion, the prompt Do you confirm generation? (yes/no) [yes] implies that by typing no, I will be given an opportunity to fix any mistakes. Instead, Poetry discards all of my work with no confirmation. Perhaps this could be improved by also addressing the above dot point - typing no could go through the prompts again and allow me to make any tweaks I need to, or ask me which section I want to address and let me modify only that section.

  • It is frustrating to manually choose packages even when I get an exact match. Perhaps if I specify a package that has an exact match it can be chosen by default, rather than prompting me to choose it.

  • It can be annoying to need to specify version requirements when creating a new project, since I want to use the latest version in almost all cases. Perhaps rather than explicitly requesting this, users could specify it when entering the package name, eg Add a package (leave blank to skip): mypy="^1.3.0" if they require anything other than the latest version?

  • No validation is performed on many inputs. If I accidentally type an invalid version (eg just then I specified mypy as the version constraint for flake8, thinking I needed to input the next package name), there is no opportunity for me to correct it. Perhaps if a version constraint doesn't match any versions of that package, an error can be given and the user can try again (of course giving the opportunity to say "no I know what I'm doing")? Similar validation would be needed for things like the Python version (is it a valid semantic versioning constraint?), the authors (does it match the format given?).

I've grouped these under the same issue, since I consider them to all be under the same umbrella of fixing the overall UI issues for the poetry init command. I'm happy for them to be split into multiple if that would work better - just let me know.

I'm also happy to try and tackle some of these myself if people think they are reasonable improvements. Just let me know and I'll see what I can do!

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 poetry init command and separate the requested keyboard editing, dependency lookup, review, confirmation, package selection, version input, and validation behaviors into focused changes. Define the desired interaction and completion checks for each behavior before choosing an implementation or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.