skillfed

textfsm

Python module for parsing semi-structured text into python tables.

textfsm v2.1.0 1.5M downloads/30d#3,812 on PyPI1,246
Permissive license Apache License, Version 2.0 AGING released

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 textfsm

uv

uv add textfsm

poetry

poetry add textfsm

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Libraries

Tags

parse cli outputtemplate-based text parsingnetwork device output parsingsemi-structured text extractionstate machine text parserstructured data from textcommand output parsing
cli-parsingnetwork-automationtext-extraction

More Libraries packages