textfsm
Python module for parsing semi-structured text into python tables.
What it is and what it does
TextFSM is a Python state-machine engine for extracting structured data from semi-formatted text, originally built at Google for parsing CLI output from networking devices. It takes a template file (which defines parsing rules and state transitions) and raw text input, then returns a list of records containing the extracted data. The template approach lets you reuse the same parser logic across different text sources by swapping templates, and you can apply multiple templates to the same input to generate different views of the data.
The package has no runtime dependencies and installs as a pure Python wheel, making it lightweight and portable. It's classified as Production/Stable and maintained by Google, though releases are infrequent (last update 484 days ago). It's widely used in network automation and system administration contexts where CLI output parsing is common.
Use it for:
- Parse network device CLI output (show commands, logs) into structured tables for automation scripts.
- Extract data from system command output (e.g., ifconfig, netstat) for monitoring or reporting.
- Build a reusable template library to parse multiple text formats without rewriting parsing logic.
- Convert semi-structured log files into structured records for analysis or database ingestion.
- Generate different data views from the same text by applying different templates to the same input.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TextFSM parses semi-structured text (like CLI command output) using template-based state machines to extract data into structured records.
Yes, if you need to parse semi-structured text with template-driven rules. TextFSM is stable, dependency-free, permissively licensed, and widely adopted in network automation. The infrequent release cadence reflects maturity rather than abandonment (last commit April 2025), but verify that its template syntax and capabilities match your parsing needs before committing to it.
Install
textfsm on PyPI
pip
pip install textfsmuv
uv add textfsmpoetry
poetry add textfsmInstalling textfsm
Before you install
Low install friction with a pure-Python wheel. The package is aging (484 days since last release) but marked Production/Stable and actively maintained—last commit was 2025-04-17 with 1246 repository stars.
License in practice
Apache License 2.0 is permissive and imposes no restrictions on commercial or proprietary use. Contributors must sign a CLA before patches are accepted.
Quickstart
pip install textfsm
import textfsm
template = textfsm.TextFSM(open('template.txt'))
result = template.ParseText(text_input)
for row in result:
print(row)
A template file matching your text structure is required; TextFSM itself has no external dependencies but you must design or obtain a template for your specific parsing task.
Verify before relying
- Whether Python 2 support is still active (wheel name suggests py2.py3 compatibility, but classifiers list only Python 3).
- Performance characteristics on large text inputs or complex templates.
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 484 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,526,601/month — #3,812 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: textfsm-2.1.0-py2.py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
ntc-templatesProvides a repository of TextFSM templates for…
permissive · top 5,000 on PyPI
ttpTTP is a Python library for parsing…
permissive · top 15,000 on PyPI
tls-parserParses TLS records from binary data, extracting…
unclear · top 15,000 on PyPI
py-deviceidGenerates or retrieves a unique device…
permissive · top 5,000 on PyPI
pdftextExtracts plain text or structured blocks,…
permissive · top 15,000 on PyPI
pylspciParses the output of the lspci command to…
copyleft · top 15,000 on PyPI
stix2-patternsValidates the syntax of STIX 2 Pattern…
permissive · top 5,000 on PyPI
sttableParses string-formatted tables (with…
permissive · top 15,000 on PyPI
parsedatetimeParses human-readable date and time strings…
permissive · top 1,000 on PyPI
tokenizerTokenizes Icelandic text into words,…
permissive · top 15,000 on PyPI