skillfed

ttp

Template Text Parser

ttp v0.10.1 479.6K downloads/30d#6,433 on PyPI393
Permissive license MIT Active released

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 ttp

uv

uv add ttp

poetry

poetry add ttp

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Utilities

Tags

semi-structured text parsingtemplate-based regex parsingtext to structured datanetwork config parsingdynamic regex templatestext data extractionparsing with templates
text-extractionnetwork-automationtemplate-parsing

More Utilities packages