You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm designing a package that have main functionality and optional functionality that requires extra packages to be installed. I want to build a CLI for the package. jsonargparse dissuades use of parse_known_args(), so I cannot import packages only when needed.
For example, I want to add optional function arguments. I cannot use parser.add_function_args because it would need me to import the function. I must add arguments manually, but I can't always do this, because some arguments may depend on classes in my optional functionality. How to manage this case? Thank you
The text was updated successfully, but these errors were encountered:
Yes, but if I try to run a command with arguments, it won't recognize them and exit, and the only way to show a message about installing additional packages, as I understand, is to catch SystemExit, which I think is not the most elegant solution.
I guess what you need is an Action that always raises an argument exception with some message. But this action must be triggered if nested arguments are given. That is, something like:
The CLI would exit with the given message if any option --group.* is given. This action would be useful for the case of optional packages, but also for deprecated options that were removed.
jsonargparse internally importing optional packages, I am not sure it is a good idea.
I'm designing a package that have main functionality and optional functionality that requires extra packages to be installed. I want to build a CLI for the package.
jsonargparse
dissuades use ofparse_known_args()
, so I cannot import packages only when needed.For example, I want to add optional function arguments. I cannot use
parser.add_function_args
because it would need me to import the function. I must add arguments manually, but I can't always do this, because some arguments may depend on classes in my optional functionality. How to manage this case? Thank youThe text was updated successfully, but these errors were encountered: