class documentation

TOML parser with support for sections.

This config parser can be used to integrate with pyproject.toml files.


    # this is a comment
    # this is TOML section table:
    # how to specify a key-value pair (strings must be quoted):
    format-string = "restructuredtext"
    # how to set an arg which has action="store_true":
    warnings-as-errors = true
    # how to set an arg which has action="count" or type=int:
    verbosity = 1
    # how to specify a list arg (eg. arg which has action="append"):
    repeatable-option = ["",
    # how to specify a multiline text:
    multi-line-text = '''
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
        Vivamus tortor odio, dignissim non ornare non, laoreet quis nunc. 
        Maecenas quis dapibus leo, a pellentesque leo. 
    # how to specify a empty text:
    empty-text = ''
    # how to specify a empty list:
    empty-list = []


>>> import configargparse
>>> parser = configargparse.ArgParser(
...             default_config_files=['pyproject.toml', 'my_super_tool.toml'],
...             config_file_parser_class=configargparse.TomlConfigParser(['tool.my_super_tool']),
...          )
Method __call__ Undocumented
Method __init__ Undocumented
Method get_syntax_description Undocumented
Method parse Parses the keys and values from a TOML config file.
Instance Variable sections Undocumented
def __call__(self) -> ConfigFileParser: (source)


def __init__(self, sections: list[str]): (source)


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


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

Parses the keys and values from a TOML config file.

sections = (source)