-
Notifications
You must be signed in to change notification settings - Fork 993
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] Running multiple commands via the CLI v2 API raises ArgumentError #14044
Comments
You can see, the second conan run complains about already registered arguments in the parser. Even recreating the API and CLI objects does not help. The following code has the same issue: from conan.api.conan_api import ConanAPI
from conan.cli.cli import Cli
conan_api = ConanAPI()
conan_cli = Cli(conan_api)
conan_api2 = ConanAPI()
conan_cli2 = Cli(conan_api2)
conan_cmd = ["list", "*"]
conan_cli.run(conan_cmd)
conan_cli.run(conan_cmd) |
Hi @fschoenm I think this is expected. The The initial planning was to document and release the |
@memsharded Please see my first comment above. Even recreating the Cli object didn't help. |
Oh, thanks for clarifying. We will check it. |
This has been fixed in #14053, and will be in 2.0.7. Note, however, that the |
@memsharded I see. I guess that's fine as long as you introduce a higher-level API. The low-level API primitives look really scary to re-implement without knowing too much about Conan internals. Just FYI, we're using it for automatically creating packages for multiple configurations and querying information from the conanfile and the dependency graph. It's stuff that could not be easily or reliably done via shell scripting due to parsing and multiple conanfiles being involved but from a Conan standpoint it would be really high-level. Thanks for the quick fix! |
Yeah, we know it. It will improve when we really start documenting it, but still we have to discuss what kind of high-level interface is the best. Thanks for the feedback! |
Environment details
Steps to reproduce
I'm trying to run conan via the CLI API to programmatically create packages. I used the CLI API like @memsharded recommended in #13065 because the low level API seems to be too complex for our use case.
However, there's apparently a problem with Conan's argument parser that seems to be reused for some reason.
Here's a small reproduction example with a simpler command (list) but the create subcommand has the same issue:
Logs
Gives the following error when run the second time:
The text was updated successfully, but these errors were encountered: