astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26k stars 762 forks source link

Incorrect suggestion when creating a new project with --backend instead of --build-backend #8743

Open styvane opened 1 week ago

styvane commented 1 week ago

uv suggests the wrong argument when creating a new project with a wrong --backend argument

uv init  --lib --backend maturin no-name

It returns the following error message:

error: unexpected argument '--backend' found

  tip: a similar argument exists: '--package'

Usage: uv init <PATH|--name <NAME>|--virtual|--package|--no-package|--app|--lib|--script|--vcs <VCS>|--build-backend <BUILD_BACKEND>|--no-readme|--author-from <AUTHOR_FROM>|--no-pin-python|--no-workspace|--python <PYTHON>>

For more information, try '--help'.

I was expecting the suggestion to be a similar argument exists: --build-backend

Version:

uv --version
uv 0.4.25 (97eb6ab4a 2024-10-21)
charliermarsh commented 1 week ago

That's an odd one though I don't think we control these suggestions.

zanieb commented 1 week ago

Yeah these are implemented in Clap, not sure what we can do here.

zanieb commented 1 week ago

I guess we can declare a hidden --backend argument with UnknownArgumentValueParser and suggest the proper one. There are some minor caveats, as discussed in https://github.com/clap-rs/clap/discussions/5781 (though that mostly focused on subcommands).