ttp
Template Text Parser
What it is and what it does
TTP is a template-driven text parser that converts unstructured or semi-structured text into hierarchical structured data. It works by dynamically generating regexes from user-defined templates with placeholder syntax, then matching and extracting data from input text. The library includes built-in functions for processing matches on-the-fly, combining results into arbitrary hierarchies, and formatting output for storage or further processing.
The package is designed for scenarios where raw text output—such as network device configurations, command outputs, or log files—needs to be transformed into machine-readable formats. It handles multi-level nesting, lookups across parsing groups, and output formatting (including tabular display), making it particularly suited for network automation and data extraction tasks where regex alone would be tedious to maintain.
Use it for:
- Parse network device configuration and state outputs (BGP, interfaces, routing) into structured JSON or dictionaries for automation workflows.
- Extract and combine data from multiple command outputs by correlating results across parsing groups using lookup functions.
- Transform unstructured log files or text reports into tabular or hierarchical formats for analysis or storage in databases.
- Build reusable parsing templates for repetitive text extraction tasks without writing custom regex code for each variation.
- Process CLI output from infrastructure tools to feed structured data into downstream systems or APIs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TTP is a Python library for parsing semi-structured text into structured data using template-based regex matching, with built-in functions for processing and transforming results.
Yes. TTP is worth installing for any project requiring semi-structured text parsing. It has zero runtime dependencies, low install friction, active maintenance, no known vulnerabilities, and a permissive MIT license. The template-based approach reduces boilerplate compared to hand-written regex, and the library's built-in processing functions handle common transformation tasks. Best fit for network automation, log parsing, and configuration extraction workflows.
Install
ttp on PyPI
pip
pip install ttpuv
uv add ttppoetry
poetry add ttpInstalling ttp
Before you install
Low install friction with no runtime dependencies. Actively maintained with recent releases; last commit 2026-03-24 and 393 repository stars indicate ongoing development.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal attribution requirements.
Quickstart
from ttp import ttp
data = "interface Loopback0\n ip address 192.168.0.113/24"
template = "interface {{ interface }}\n ip address {{ ip }}/{{ mask }}"
parser = ttp(data, template)
parser.parse()
result = parser.result()
Requires Python 3.9 or later (supports 3.9 through 3.14).
Verify before relying
- Performance characteristics with large text inputs or complex template hierarchies
- Comparison of template syntax learning curve relative to other parsing libraries
- Availability and maturity of the community template collection referenced in documentation
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 146 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 479,568/month — #6,433 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ttp-0.10.1-py3-none-any.whl
Keywords: Parsing, TTP, regex
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
ttp_templatesProvides a curated collection of TTP (Template…
permissive · top 15,000 on PyPI
ntc-templatesProvides a repository of TextFSM templates for…
permissive · top 5,000 on PyPI
textfsmTextFSM parses semi-structured text (like CLI…
permissive · top 5,000 on PyPI
stringparserExtracts values from strings using…
permissive · top 15,000 on PyPI
multiregexMatches multiple regex patterns against a…
permissive · top 15,000 on PyPI
pyap2Pyap2 detects and parses postal addresses from…
permissive · top 15,000 on PyPI
parseParse strings using format-string-like patterns…
permissive · top 5,000 on PyPI
commonregexExtracts dates, times, emails, phone numbers,…
permissive · top 15,000 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
stixParses, manipulates, and generates STIX v1.2.0…
permissive · top 15,000 on PyPI