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
[bug] order of command line params now matters #6719
Comments
moving keysight/stable to just after the '.' fixes it however i have dozens of scripts that would need fixed to resolve this and i don't think it should matter the order if it didn't in the past. |
Thanks for reporting this. Up to my knowledge nothing has changed in the command line to cause this issue. From what version are you upgrading? Could you please check that the upgrade is only Conan and not anything in the environment that could affect, as dependencies (pip list them, please) or the python version itself? In any case, I have found that the python argparse module is not rock solid regarding positional parameters, this is why I always recommend always to define the positional arguments first in the command line, and then the optional ones (even if that is not the convention in linux). Please let me know the above, let's try to identify if there has been some regression that we could fix on our side. |
Before the upgrade I was using python 3.7.x and i don't have records of exact conan version but it was probably around 1.18 or so. yeah this is being run under windows but for the entire previous history of using conan as such it never complained about the order of these args and unfortunately i have actually more then dozens (closer to a hundred) scripts specified the way it is. |
upgraded (broken) environment is cmake 3.17.0 + python 3.8.2 + conan 1.23.0 running under latest windows 10 |
There is a relatively easy test. In the same environment that you are running with python 3.8, do a forced |
Could this be related to an "issue" I pointed out too? See here: conan-io/docs#1051 (comment) Despite the content of the docs one should not put the path/reference behind any command line options. |
Yes, exactly, in any case, the positional args should be the very first, or the very last, but it is quite discourage to put them in between optional arguments, up to my knowledge. Please @keysight-daryl let me know if you managed to test in your env with 1.18.0. |
yes this worked fine up until my upgrade to the latest so 1.18 with python 3.7 should not cause this error.
…________________________________
From: James <notifications@github.com>
Sent: Tuesday, March 24, 2020 6:19 AM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
Yes, exactly, in any case, the positional args should be the very first, or the very last, but it is quite discourage to put them in between optional arguments, up to my knowledge.
Please @keysight-daryl<https://urldefense.com/v3/__https://github.com/keysight-daryl__;!!I5pVk4LIGAfnvw!yQ2GbN2g46gt24luElgMH6yL5YJAbIliSL9MYcvr6ANKW-wYvsP0jfnFwIRIgrX5CdD5jg$> let me know if you managed to test in your env with 1.18.0.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-603152050__;Iw!!I5pVk4LIGAfnvw!yQ2GbN2g46gt24luElgMH6yL5YJAbIliSL9MYcvr6ANKW-wYvsP0jfnFwIRIgrVJRxeeeA$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGTIAGXE5DH4B7VZZ3DRJCCKJANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!yQ2GbN2g46gt24luElgMH6yL5YJAbIliSL9MYcvr6ANKW-wYvsP0jfnFwIRIgrVCctwGng$>.
|
Yes, I got that, but not sure if I was clearly pointing the possible error. What I am saying is that the argparse standard library in Python 3.8 might be behaving differently, and it seems that there is probably nothing we can do in the Conan codebase, besides saying in the docs that the positional arguments should be either in the beginning or at the end of the command line, but not in the middle. This is what it would be useful to check if Conan 1.18 works fine with Python 3.8 |
could be, don't have time to revert or play around at the moment but seems something someone else could verify.
…________________________________
From: James <notifications@github.com>
Sent: Tuesday, March 24, 2020 1:50 PM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
yes this worked fine up until my upgrade to the latest so 1.18 with python 3.7 should not cause this error.
Yes, I got that, but not sure if I was clearly pointing the possible error. What I am saying is that the argparse standard library in Python 3.8 might be behaving differently, and it seems that there is probably nothing we can do in the Conan codebase, besides saying in the docs that the positional arguments should be either in the beginning or at the end of the command line, but not in the middle. This is what it would be useful to check if Conan 1.18 works fine with Python 3.8
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-603405170__;Iw!!I5pVk4LIGAfnvw!3NUYUyshOisSx-y7KW-54p7u48fxm7moiLpIxz7qkSR17lCwHq2qSzSRyIdy8z8vMEdQLw$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGRJU5RTLPWX7F3CSTLRJDXGPANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!3NUYUyshOisSx-y7KW-54p7u48fxm7moiLpIxz7qkSR17lCwHq2qSzSRyIdy8z_F-KfxRw$>.
|
I have done the check: (conanpip38) λ python --version
Python 3.8.1
(conanpip38) λ conan --version
Conan version 1.18.5
(conanpip38) λ conan create . -tf=test_package -pr=default user/testing --build=missing
usage: conan create [-h] [-j JSON] [-k] [-kb] [-ne] [-tbf TEST_BUILD_FOLDER] [-tf TEST_FOLDER] [-m [MANIFESTS]] [-mi [MANIFESTS_INTERACTIVE]] [-v [VERIFY]] [-b [BUILD]]
[-e ENV] [-o OPTIONS] [-pr PROFILE] [-r REMOTE] [-s SETTINGS] [-u] [-l [LOCKFILE]]
path [reference]
conan create: error: unrecognized arguments: user/testing
ERROR: Exiting with code: 2 So it seems confirmed this is not a bug in Conan, and Conan has not changed this behavior since Conan 1.18. This is a change in the python ecosystem and how python interprets arguments with its |
@memsharded As you said the docs are parsed and generated and you cannot change the parameter order, it would be helpful to make some note at the commands like conan remove etc. to strongly recommend the correct usage. Otherwise users are playing around and use what is "working" but this does not necessarily mean that it is the correct way ( own experience :) ). |
Hi @Johnnyxy Yes, agree. If @keysight-daryl agrees too, I'll move this to the docs to try to clarify this issue there, |
yeah sure i just put them in the order i did because i remember that was the order I saw them in the docs... i agree it should be clarified if possible. is there a --repo=keysight/stable i can use instead so it can be put anywhere in the args?
…________________________________
From: James <notifications@github.com>
Sent: Wednesday, March 25, 2020 4:51 AM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
Hi @Johnnyxy<https://urldefense.com/v3/__https://github.com/Johnnyxy__;!!I5pVk4LIGAfnvw!wqPLF5G5SHwO89IBdyNTWyQu5Y2SJFh_fUajdUhdqU8soS6TNGxneNRFLqYspbIJkX-fNQ$>
Yes, agree. If @keysight-daryl<https://urldefense.com/v3/__https://github.com/keysight-daryl__;!!I5pVk4LIGAfnvw!wqPLF5G5SHwO89IBdyNTWyQu5Y2SJFh_fUajdUhdqU8soS6TNGxneNRFLqYspbJREKMhZw$> agrees too, I'll move this to the docs to try to clarify this issue there,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-603718502__;Iw!!I5pVk4LIGAfnvw!wqPLF5G5SHwO89IBdyNTWyQu5Y2SJFh_fUajdUhdqU8soS6TNGxneNRFLqYspbI-gTSSug$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGU4GNG25JDZ6ECIVXDRJHAX7ANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!wqPLF5G5SHwO89IBdyNTWyQu5Y2SJFh_fUajdUhdqU8soS6TNGxneNRFLqYspbINh0ugKg$>.
|
I am sorry, I am afraid |
--whatever it should be called. the idea here is it would allow order to be irrelevant in the future.
…________________________________
From: James <notifications@github.com>
Sent: Thursday, March 26, 2020 1:08 PM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
I am sorry, I am afraid --repo=keysight/stable doesn't exist. It is not related to a repo at all, it is the user/channel, but it can be uploaded/downloaded from any repo. And in any case, it would require to modify all your command line anyway, so it is not that it would avoid changing your command line invocation code.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-604553634__;Iw!!I5pVk4LIGAfnvw!zdZw5DAe9RrY6RHKXXq32iZIN3ZkWhyduOLPuMTw70NYWShha68atfSUuCrr7iyOFEozXw$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGXXCPZT5IQ3MECBOBTRJOD2BANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!zdZw5DAe9RrY6RHKXXq32iZIN3ZkWhyduOLPuMTw70NYWShha68atfSUuCrr7iw6BrsITQ$>.
|
It depends. |
could be either right? it is required but specified as either without the --flag and order is important or with and order is not important.
…________________________________
From: Johnnyxy <notifications@github.com>
Sent: Thursday, March 26, 2020 4:00 PM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
It depends. --whatever are parameters like -o or -s which modify the behaviour of or give hints to a command. But the reference or user/channel on several commands is a necessity to function at all. If the user/channel would be specified with --whatever user/channel one could get the impression that it is optional to specify it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-604654388__;Iw!!I5pVk4LIGAfnvw!0Z-v_OB8aUF18QAp36_96MpybR2-kACyzTTCiXuz9R1RBxzK4ofHb74f6piLzTzazm1ydg$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGWAKYG5AKJSJFIQXP3RJOX6JANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!0Z-v_OB8aUF18QAp36_96MpybR2-kACyzTTCiXuz9R1RBxzK4ofHb74f6piLzTw0sD9oug$>.
|
The conan command line has some flaws that need to be improved, and we will when we have the occasion to break (Conan 2.0). But I am sorry, but that would be bad command line or api design. You cannot have 2 ways to introduce the same information both as positional and optional in the same command. What if they provide the two, but they are different? Having 2 ways to do the same thing should be avoided, it should be one or the other. Positional if it is mandatory, and optional if it is optional. |
up to you, just suggesting a way to do it. regarding how would you handle adding both? throw an error of course like you do now. it's not rocket science.
…________________________________
From: James <notifications@github.com>
Sent: Thursday, March 26, 2020 7:44 PM
To: conan-io/conan <conan@noreply.github.com>
Cc: Daryl Fortney <daryl.fortney@keysight.com>; Mention <mention@noreply.github.com>
Subject: Re: [conan-io/conan] [bug] order of command line params now matters (#6719)
[EXTERNAL]
could be either right? it is required but specified as either without the --flag and order is important or with and order is not important.
The conan command line has some flaws that need to be improved, and we will when we have the occasion to break (Conan 2.0). But I am sorry, but that would be bad command line or api design. You cannot have 2 ways to introduce the same information both as positional and optional in the same command. What if they provide the two, but they are different? Having 2 ways to do the same thing should be avoided, it should be one or the other. Positional if it is mandatory, and optional if it is optional.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/conan-io/conan/issues/6719*issuecomment-604742454__;Iw!!I5pVk4LIGAfnvw!188WbocDbLWPrRUC3dE3slEtmbvRrL3-w46VjB-JpI9F_hPH5TaA279mpqubIU-5Igyx8w$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJSRHGSYUZ5T2QIHCJJVUI3RJPSGNANCNFSM4LSCH4FQ__;!!I5pVk4LIGAfnvw!188WbocDbLWPrRUC3dE3slEtmbvRrL3-w46VjB-JpI9F_hPH5TaA279mpqubIU_gMkhGMw$>.
|
This proved to be a bug in Python Closing this as out of scope |
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
put the repo id (keysght/stable) after some other options in the command line
Logs (Executed commands with output) (Include/Attach if Applicable)
attached
The text was updated successfully, but these errors were encountered: