class documentation

A config parser that understands multiple formats.

This parser will successively try to parse the file with each compisite parser, until it succeeds, else it fails showing all encountered error messages.

The following code will make configargparse understand both TOML and INI formats. Making it easy to integrate in both pyproject.toml and setup.cfg.

>>> import configargparse
>>> my_tool_sections = ['tool.my_super_tool', 'tool:my_super_tool', 'my_super_tool']
...                     # pyproject.toml like section, setup.cfg like section, custom section
>>> parser = configargparse.ArgParser(
...             default_config_files=['setup.cfg', 'my_super_tool.ini'],
...             config_file_parser_class=configargparse.CompositeConfigParser(
...             [configargparse.TomlConfigParser(my_tool_sections), 
...                 configargparse.IniConfigParser(my_tool_sections, split_ml_text_to_list=True)]
...             ),
...          )
Method __call__ Undocumented
Method __init__ Undocumented
Method get_syntax_description Undocumented
Method parse Undocumented
Instance Variable parsers Undocumented
def __call__(self) -> ConfigFileParser: (source)

Undocumented

def __init__(self, config_parser_types: list[Callable[[], ConfigFileParser]]): (source)

Undocumented

def get_syntax_description(self) -> str: (source)

Undocumented

def parse(self, stream: TextIO) -> dict[str, Any]: (source)

Undocumented

Undocumented