spock icon indicating copy to clipboard operation
spock copied to clipboard

Is it possible to set a default namespace for command-line arguments?

Open wanicca opened this issue 2 years ago • 3 comments

spock-config is a nice alternative to argparse. However, we have to add namespace name in argument (e.g. --BaseConfig.lr=value). That is sometimes cumbersome. If there is a way to set default namespace, the command-line arguments can work more like argparse.

Of course, to avoid conflict, some arguments (h,help,c,config) cannot be in such default namespace.

wanicca avatar Mar 30 '22 07:03 wanicca

Hi @wanicca

It's possible and I see the difficulty with verbosity (and not 1:1 drop in for argparse)...

However given the user defined hierarchy and inheritance, it's pretty hard to cleanly maintain a global namespace as well as a class specific namespace within the arg_parser (we already do this for file based definitions and it's a nightmare to maintain).

Happy to have you contribute via a PR if it's something you think you'd want to add, but as of right now I'd say this is probably a backlog item for the time being.

I'll leave the issue open for the time being so it stays on the backlog or for you to link to a PR if you want to contribute!

ncilfone avatar Apr 12 '22 14:04 ncilfone

@ncilfone I would like to work on this, could you please assign this to me

nagavenkateshgavini avatar Feb 29 '24 08:02 nagavenkateshgavini

I do not have the power to assign anymore but that doesn't prevent you from working on a PR to contribute!

ncilfone avatar Feb 29 '24 21:02 ncilfone