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` regression for handling command flags #1500

Open
wesleykendall opened this issue Oct 25, 2019 · 14 comments
Labels
Bug

Comments

@wesleykendall
Copy link

@wesleykendall wesleykendall commented Oct 25, 2019

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Darwin 10.14.6
  • Poetry version: 1.0.0.b3
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

In poetry==1.0.0.b3, it seems that poetry run interprets any CLI options as its own rather than passing them through.

For example:

poetry run python manage.py makemigrations --check

> [NoSuchOptionException]
> The "--check" option does not exist.

In poetry==1.0.0.b1, this was not an issue.

This can be re-created by basic commands like so:

poetry run ls -l

[NoSuchOptionException]
The "-l" option does not exist.
@wesleykendall wesleykendall added the Bug label Oct 25, 2019
@wesleykendall

This comment has been minimized.

Copy link
Author

@wesleykendall wesleykendall commented Oct 25, 2019

I made a couple follow-up comments on this thread that were inaccurate, so I deleted them in order to avoid confusion.

The workaround I'm going to use for now is reverting back to poetry==1.0.0b1 since it seems to be working fine still.

@wesleykendall

This comment has been minimized.

Copy link
Author

@wesleykendall wesleykendall commented Oct 25, 2019

For those running into issues installing poetry==1.0.0.b1 with pipx, this is the workaround I did:

pipx install poetry==1.0.0.b1
pipx runpip poetry==1.0.0b1 install cleo==0.7.5 clikit==0.3.2
@M5oul

This comment has been minimized.

Copy link

@M5oul M5oul commented Oct 26, 2019

For Pip:

pip3 install --user poetry==1.0.0b2 clikit==0.3.2
@max-wittig

This comment has been minimized.

Copy link

@max-wittig max-wittig commented Oct 26, 2019

Same here. (Might be a macOS only thing)

@n8sty

This comment has been minimized.

Copy link
Contributor

@n8sty n8sty commented Oct 26, 2019

I'm experiencing this on Ubuntu 18 with 1.0.0b3 as well. An example when trying to invoke pre-commit:

15:15 $ poetry run pre-commit run --all-files

[NoSuchOptionException]
The "--all-files" option does not exist.
@c0state

This comment has been minimized.

Copy link

@c0state c0state commented Oct 27, 2019

If you upgrade to 1.0.0b3, you need to use -- to stop options parsing now it looks like.

See this change in the clikit dependency which poetry uses:
sdispater/clikit#2

Edit: you shouldn't need this anymore with the latest 1.0.0b4 release it looks like. That release is more in line with #1500 (comment)

@515hikaru

This comment has been minimized.

Copy link

@515hikaru 515hikaru commented Oct 27, 2019

I could show python --help with poetry run by following:

poetry run python -- --help

In Poetry version 1.0.0b3

@n8sty

This comment has been minimized.

Copy link
Contributor

@n8sty n8sty commented Oct 27, 2019

I'm experiencing this on Ubuntu 18 with 1.0.0b3 as well. An example when trying to invoke pre-commit:

15:15 $ poetry run pre-commit run --all-files

[NoSuchOptionException]
The "--all-files" option does not exist.

I can confirm that poetry run pre-commit -- run --all-files works. It seems like it doesn't particularly matter where the -- gets put in the command as poetry run -- pre-commit run --all-files and poetry run pre-commit run -- --all-files seem to have the same effect.

@itajaja

This comment has been minimized.

Copy link

@itajaja itajaja commented Oct 29, 2019

This is really surprising and unexpected behavior. compare:

poetry run python abc
poetry run python --abc

in the former case, abc is passed to python, in the latter it is passed to poetry. It's really weird that the discriminant is whether is an option or a vararg. afaict no state of the art cli behaves this way. if you really wanted to discriminate where an argument is passed, the docker behavior is more suitable

docker run --foo image bash # foo passed to docker
docker run image bash --foo # foo passed to subcommand
@itajaja

This comment has been minimized.

Copy link

@itajaja itajaja commented Oct 29, 2019

usage of -- is legitimate when there is an ambiguity, which is not the case for poetry run

@sdispater

This comment has been minimized.

Copy link
Owner

@sdispater sdispater commented Oct 29, 2019

Commit 85dc9a1 should fix most of the issues with the run command.

I will try to make a new beta release this week.

sindrehan added a commit to BluEye-Robotics/blueye.sdk that referenced this issue Nov 5, 2019
See this issue:
sdispater/poetry#1500

Should be fixed in poetry soon.
@515hikaru 515hikaru mentioned this issue Nov 8, 2019
3 of 3 tasks complete
@n8sty

This comment has been minimized.

Copy link
Contributor

@n8sty n8sty commented Nov 13, 2019

Seems like with version 1.0.0b4 this is working again - at least in my case above

@bersace

This comment has been minimized.

Copy link

@bersace bersace commented Nov 13, 2019

I confirm the fix. 1.0.0b4 is ok. Merci @sdispater !

@wesleykendall

This comment has been minimized.

Copy link
Author

@wesleykendall wesleykendall commented Nov 14, 2019

Thanks @sdispater ! Should I close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.