arg

arg

Argument definition

This module enables the definitions of various kinds of configuration arguments.

  • Parameters (Param) correspond to values that will be present in the configuration. Each invocation of a parameter has a user-provided string attached, which is parsed by a Parser. Those invocations can come from environment variables (Param.env_var_name), configuration files (Param.config_key_name), command-line flags (Arg.short_flag_name, Arg.long_flag_name), or finally as positional command-line parameters (Param.positional).

  • Configuration file inclusion using special parameters Param.config()

  • Expanders (Expander) can only be present as command-line flags; their action is to insert a key/value pair in the command-line. This enables, for example, flags that set a boolean parameter to True or False.

Types

This module uses the following types.

_Config

Configuration dataclass type being constructed

_Arg

Precise argument type, used mostly internally.

See https://en.wikipedia.org/wiki/Bounded_quantification

_Value_co

Type of the parameter value

_Item_co

Item in a sequence

Classes

Arg

Base class for all kinds of arguments

Expander

Command-line argument that expands into a flag/value pair

Param

Describes an argument holding a value of a given type