arcon

Persistent runtime config.

class arcon.ArgumentParser(version: str, prog: str | None = None, usage: str | None = None, description: str | None = None, epilog: str | None = None, parents: _t.Sequence[ArgumentParser] = [], formatter_class: _FormatterClass = <class 'argparse.HelpFormatter'>, prefix_chars: str = '-', fromfile_prefix_chars: str | None = None, argument_default: _t.Any = None, conflict_handler: str = 'error', add_help: bool = True, allow_abbrev: bool = True, config: dict[str, _t.Any] | None = None, version_short_form: str = '-v')[source]

Bases: ArgumentParser

Parse commandline arguments.

Parameters:
  • version – Version of package, if there is one.

  • prog – The name of the program (default: sys.argv[0]).

  • usage – A usage message (default: auto-generated from arguments).

  • description – A description of what the program does.

  • epilog – Text following the argument descriptions.

  • parents – Parsers whose arguments should be copied into this one.

  • formatter_class – HelpFormatter class for printing help messages.

  • prefix_chars – Characters that prefix optional arguments.

  • fromfile_prefix_chars – Characters that prefix files containing additional arguments.

  • argument_default – The default value for all arguments.

  • conflict_handler – String indicating how to handle conflicts.

  • add_help – Add a -h/-help option.

  • allow_abbrev – Allow long options to be abbreviated unambiguously.

  • config – A dict object containing default values for parser. If no dict object provided than a pyproject.toml file will be loaded.

  • version_short_form – Alternative short form for version.

add_dict_argument(*args: str, nargs: str = '*', **kwargs: Any) None[source]

Parse key(s) of comma separated lists of strings into a dict.

Parameters:
  • args – Long and/or short form argument(s).

  • nargs – Nargs to pass to add_argument.

  • kwargs – Kwargs to pass to add_argument.

add_list_argument(*args: str, **kwargs: Any) None[source]

Parse a comma separated list of strings into a list.

Parameters:
  • args – Long and/or short form argument(s).

  • kwargs – Kwargs to pass to add_argument.

parse_known_args(args: _t.Sequence[str] | None = None, namespace: _Namespace | None = None) tuple[_Namespace | None, list[str]][source]