Poetry remove fails to remove any packages?

Question:

Poetry install:

(installs dependencies)
poetry show --tree

black 20.8b1 The uncompromising code formatter.
├── appdirs *
├── click >=7.1.2
├── mypy-extensions >=0.4.3
├── pathspec >=0.6,<1
├── regex >=2020.1.8
├── toml >=0.10.1
├── typed-ast >=1.4.0
└── typing-extensions >=3.7.4

Next, poetry remove…

poetry remove black


  ValueError

  Package black not found

  at ~/proj/venv/lib/python3.9/site-packages/poetry/console/commands/remove.py:52 in handle
      48│                     requirements[key] = poetry_content[section][key]
      49│                     break
      50│
      51│             if not found:
    → 52│                 raise ValueError("Package {} not found".format(name))
      53│
      54│         for key in requirements:
      55│             del poetry_content[section][key]
      56│

The lack of search threads on this topic indicates, to me, that something that should "just work" is failing.

Any ideas?

Asked By: Chris

||

Answers:

If black is specified as a development dependency in pyproject.toml (quite likely as it is a code formatter) the --dev (or -D for short) option should be used with poetry remove i.e:

poetry remove --dev black
Answered By: elukem
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.