-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Description
I've been trying to use the excellent -P/--project option from #9831. It is documented like this:
$ poetry help run
...
Usage:
run [options] [--] <args>...
...
-P, --project=PROJECT Specify another path as the project root. ...Using the GNU-style long --project=PROJECT syntax or the more classic short -Pvalue syntax fails with an obscure error:
$ poetry -P. run echo hi
Command not found: run
$ poetry --project=. run echo hi
Command not found: run
$ poetry run -P. -- echo hi
Command not found: -P.
$ poetry run --project=. -- echo hi
Command not found: --project=.Everything works correctly when the value is space-separated:
$ poetry -P . run echo hi
hi
$ poetry --project . run echo hi
hi
$ poetry run -P . -- echo hi
hi
$ poetry run --project . -- echo hi
hiSuggested resolution:
- support the common
--option=valueand-ovaluesyntaxes for command line arguments in addition to space-separated arguments - alternatively, adjust the docs (both
poetry --helpand on the website) to avoid showing--option=valuestyle syntax
This is probably an issue in the underlying python-poetry/cleo library, which documents syntax like "--yell=loud" and has a test for this pattern. But maybe there's some bad interaction with subcommands, or Poetry is using Cleo in some unusual way here. Evidence in favor of the subcommand hypothesis is that a bare poetry -P. does run without errors. Anyways, I'm just a Poetry user and have therefore reported the issue here.
Workarounds
Pass option names and values as separate CLI arguments, not as a single string.
Poetry Installation Method
pipx
Operating System
Ubuntu 24.04
Poetry Version
Poetry (version 2.0.1)
Poetry Configuration
N/APython Sysconfig
N/A
Example pyproject.toml
N/APoetry Runtime Logs
no relevant logs