ttp-templates is a Python library that provides a curated collection of Text Template Parser (TTP) templates, primarily focused on parsing network device CLI output. It extends the core TTP parser by offering an easy way to access and apply pre-built templates for various vendors and commands, including "getter" templates for normalized data. The current version is 0.5.1, with releases occurring periodically to add new templates and features or address issues.
pip install ttp-templatesVerified import paths — ran on the pinned version, not inferred.
Initializes the TTPTemplates parser, provides sample network device output, and demonstrates how to use a bundled 'getter' template to parse and normalize the data. The 'platform' argument helps select the correct template logic for vendor-specific output.
Ensure `parse_output` is always called with one of `template_name`, `template_path`, or `template_string` arguments correctly populated.
Adjust code that processes the `result` from `parser.parse_output` to expect a more direct data structure, typically `result[0]` containing the list of parsed dictionaries.
Understand that `ttp-templates` is a collection of templates and convenience methods, whereas `ttp` is the fundamental parsing library. For advanced parsing or custom templates, you might interact directly with `ttp`.