Registry / data / ttp-templates

ttp-templates

JSON →
library0.5.8pypypi✓ verified 84d ago

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-templates
INSTALL
IMPORT
SIG · TTP-TEMPLATES
T
ttp-templates
datapythonv0.5.8
Install
2.9s avg
Import
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.8 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 29.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.9s · import 0.000s · 29MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_template
from ttp_templates import get_template
from ttp_templates import TTPTemplates
list_templates
from ttp_templates import list_templates
parse_output
from ttp_templates import parse_output

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.

from ttp_templates import TTPTemplates # Initialize TTPTemplates parser = TTPTemplates() # Example device output for `get/inventory.txt` on Cisco NX-OS # This output structure is a simplified representation of `show inventory` device_output = """ NAME: "Chassis", DESCR: "Nexus9000 C9372PX Chassis" PID: N9K-C9372PX, VID: V01, SN: FOC12345678 NAME: "Slot 1", DESCR: "Supervisor" PID: N9K-SUP-A, VID: V01, SN: JAE12345678 """ # Parse the output using the 'get/inventory.txt' template # The 'platform' argument is often crucial for getter templates to select the right internal logic result = parser.parse_output( data=device_output, template_name="get/inventory.txt", platform="cisco_nxos" ) # Print the normalized result # 'result' is typically a list of lists, where inner list contains dictionaries # In v0.5.1, it returns only the parsing result for the matched template. if result and result[0]: print("Parsed Inventory Data:") for item in result[0]: print(item) else: print("No data parsed or template did not match.")
Debug
Known issues
breakingCalling `parse_output` without a valid template-locating argument (e.g., `template_name`, `template_path`, `template_string`) now raises a `ValueError`. Previously, it silently forwarded `None` to the TTP constructor, leading to confusing downstream errors.
fix
Ensure `parse_output` is always called with one of `template_name`, `template_path`, or `template_string` arguments correctly populated.
affects: >=0.4.0
breakingThe `get` results return now includes only the parsing result for the matched template. This streamlines the output but might change the structure if prior versions returned additional metadata around the result.
fix
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.
affects: >=0.5.1
gotchaWhile `ttp-templates` installs the underlying `ttp` parser library automatically, users often confuse the two. `ttp-templates` provides the template files and a simplified API to access them, but `ttp` is the core engine for parsing.
fix
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`.
affects: All
Upgrade
Version history
0.5.8latest on PyPI · released Jun 2, 2026
Audit
Dependencies
ttprequiredCore parsing engine for which these templates are designed. Automatically installed as a dependency.
Agent activity
28 hits · last 30 days
node
20
Amazon
1
Bingbot
1
OpenAI (training)
1
Resources