Limitations

While the ArgParseDecorator tries to make as much functionality of the argparse library available as possible in a decorator, there are some limitations.

Some options of argparse could not be implemented in an elegant way using annotations. However, if these options are really required they can still be used by using the add_argument() decorator instead of using annotations.

Other options that are not supported are:

  1. Using the dest option

    dest changes the name of an argument to some other internal value. Using Annotations the dest of an argument must always be the default, that is the name of the annotated variable, otherwise the mapping of the return values from ArgumentParser.parse_args to the variable names of the decorated python command function will get messed up. Therefore the dest argument option is not supported by the ArgParseDecorator library.

    This affects the following other option, which only work by setting dest and is therefore also not directly supported as annotations:

  2. Argument grouping

    Grouping of arguments is currently not supported but could possibly be added with a docstring option if there is demand for it.

  3. Mutual exclusion

    Like the similar argument groups this is not supported yet, but could be if someone needs it.

  4. Partial parsing

    Not supported and probably not required.

  5. Some options of the ArgumentParser class

    The following options should not be used:

    • prog: this adds the given program name to the help of every command which is probably not very helpful

    • parents: ArgParseDecorator manages only a single command tree and would not know how to call commands functions from other ArgumentParsers

    • prefix_chars: Use of - and -- to mark Flag and Option is hardwired into the ArgParseDecorator logic and can not be easily changed.

    • add_help: ArgParseDecorator has its own Help system and manages this option itself.