Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry run doesn't work with --directory= #434

Open
Slooz opened this issue Aug 13, 2024 · 1 comment
Open

Poetry run doesn't work with --directory= #434

Slooz opened this issue Aug 13, 2024 · 1 comment
Labels
bug Something isn't working as expected
Milestone

Comments

@Slooz
Copy link

Slooz commented Aug 13, 2024

Description

Doesn't work:

poetry run --directory={path} python file.py

Works:

poetry run --directory {path} python file.py

See comment by @Agalin in python-poetry/poetry#7507 (comment)

See python-poetry/poetry#9623

Workarounds

Yes, use --directory {path} instead of --directory={path}

Poetry Installation Method

pipx

Operating System

Ubuntu 22

Poetry Version

1.8.3

Poetry Configuration

No response

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

No response

@latk
Copy link

latk commented Jan 18, 2025

I recently stumbled across the same issue with the poetry --project option. @abn kindly tried to fix this in the Poetry code that pre-processes arguments before passing them to Poetry, but that arguably just makes the problem worse. I'm not sure it can be fixed without explicit support by Cleo for this pattern?

In this context, I'd like to highlight that Poetry/Cleo handling of short and long options with values seems to be fairly unpredictable, e.g. I'd expect poetry -C path, poetry -Cpath, poetry --directory path, and poetry --directory=path to all be fully equivalent (and similarly for -P/--project). These equivalences are a common Linux command line convention (aka "whatever GNU getopt_long does", also well-supported by Python's argparse module). Yet we can observe a diverse range of errors with the poetry [OPTIONS] run [OPTIONS] COMMAND... syntax.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants