uv icon indicating copy to clipboard operation
uv copied to clipboard

Improve message when attempting to remove package from wrong dependency group

Open dean-tate opened this issue 11 months ago • 1 comments

uv version: 0.5.9

If you have dependency groups and attempt to remove a package from the wrong group the warning message provided gives an incomplete command.

[project]
name = "myproject"
version = "0.1.0"
description = "Add your description here"
requires-python = ">=3.11"
[dependency-groups]
dev = [
        "black",
]
test = [
        "pytest",
        "pytest-cov",
]
uv remove pytest --group dev
warning: `pytest` is in the `test` group; try calling `uv remove --group test`
error: The dependency `pytest` could not be found in `dev-dependencies` or `dependency-groups.dev`

The command suggested uv remove --group test is incomplete - the suggestion could just include pytest to make it a valid command.

In addition, the error message for the command below seems confusing too - the black dependency was found in dependency-groups after-all.

uv remove black --group test
warning: `black` is in the `dev` group; try calling `uv remove --group dev`
error: The dependency `black` could not be found in `dependency-groups`

dean-tate avatar Dec 17 '24 05:12 dean-tate