Skip to main content

ParseFabric logo

ParseFabric

CI Documentation PyPI Python 3.12 | 3.13 | 3.14 | 3.15 Coverage 100% Typed License: Apache 2.0

Composable parsers that turn logs, JSON, command output and mixed text into structured events, with evidence for every event and lossless aggregation.

ParseFabric is an asynchronous Python library for extracting structured events from operational text. Every event records exactly where it came from: the source, line number, byte span, matching pattern and parser version. Events can be stored as compact, checksummed aggregates that rebuild the exact original events on demand.

Highlights

  • Evidence on every event. Trace each finding back to the exact input that produced it.
  • Built-in parsers. Application and timestamped logs, JSON, Python tracebacks and command output (through jc).
  • Composable. Build parsers from regex, exact-value, predicate and structured patterns, or write your own parser class.
  • Mixed documents. Route each line to the right parser, parse fenced blocks by language and detect code with tree-sitter. No line is lost.
  • Lossless aggregation. Store repetitive events compactly in a strict, versioned format, then rebuild and verify every original event.
  • Streaming and parallel. Bounded concurrency, thread and process backends, partitioning of large documents, and your own backends for clusters.
  • Observable. Lifecycle events for OpenTelemetry and structlog.
  • Replace any part. Aggregators, codecs, partitioners, execution backends, sinks, language models, tokenizers and more are abstract base classes with defaults. Subclass one, pass it in, and verify it with the contract checks in parsefabric.testing.
  • Checked summaries. Optional language-model reports over aggregates, with every claim checked against the evidence.

Installation

pip install parsefabric

ParseFabric supports Python 3.12, 3.13, 3.14 and 3.15 on Linux, macOS and Windows.

Quick example

import asyncio

from parsefabric import ParseContext, ParseEngine
from parsefabric.builtins import ApplicationLogParser

LOG = """\
2026-10-04T08:15:02Z INFO checkout started
2026-10-04T08:15:04Z ERROR payment gateway timed out after 30s
2026-10-04T08:15:09Z ERROR payment gateway timed out after 30s
"""


async def main() -> None:
    engine = ParseEngine()
    parser = ApplicationLogParser()
    context = ParseContext(source_id="checkout.log")

    result = await engine.parse(parser, LOG, context)
    for event in result.events:
        evidence = event.evidence
        print(
            f"{event.event_type:<8} line {evidence.line_number}, "
            f"bytes {evidence.start_offset}-{evidence.end_offset}"
        )

    aggregates = await engine.aggregate(parser, result.events)
    stored = await engine.serialize(aggregates)
    restored = await engine.materialize(parser, LOG, await engine.deserialize(stored), context)
    print("rebuilt exactly:", restored == result.events)


asyncio.run(main())

Output:

timeout  line 2, bytes 43-106
error    line 2, bytes 43-106
timeout  line 3, bytes 106-169
error    line 3, bytes 106-169
rebuilt exactly: True

Mixed documents

import asyncio

from parsefabric import ParseEngine
from parsefabric.builtins import JSONParser, MixedContentParser, TimestampedLogParser
from parsefabric.patterns import RegexPattern

parser = MixedContentParser(
    routes=[
        (RegexPattern("log-line", r"^\d{4}-\d\d-\d\dT"), TimestampedLogParser()),
        (RegexPattern("json-line", r"^\{"), JSONParser()),
    ]
)

NOTE = """\
2026-10-01T08:00:02+00:00 ERROR shop database timeout
{"service": "shop", "state": "degraded"}
operator note: failover requested
def retry(order):
    return gateway.charge(order)
"""


async def main() -> None:
    result = await ParseEngine().parse(parser, NOTE)
    for event in result.events:
        print(event.evidence.line_number, event.event_type, event.evidence.parser_name)


asyncio.run(main())

Output:

1 log timestamped-log
2 json_record json
3 other mixed-content
4 code mixed-content
5 code mixed-content

How it fits together

ParseFabric architecture

Documentation

The full documentation is at parsefabric.readthedocs.io.

Topic Link
Install and first steps Installation, Quickstart
How parsing, evidence and aggregation work User guide
Runnable examples with their output Examples
Writing your own components Extending ParseFabric
Every public class and function API reference
Security, failure handling and performance Operations
Using ParseFabric with AI coding agents Agent Skills

Contributing

Contributions are welcome. See the contributing guide for the development setup and checks, and the code of conduct. Report security issues privately as described in the security policy.

License

ParseFabric is licensed under the Apache License 2.0.

Metadata

Release files for parsefabric 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parsefabric 1.0.1
File Size Uploaded Provenance Actions
parsefabric-1.0.1.tar.gz 93.8 kB Without provenance Details for parsefabric-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for parsefabric 1.0.1
File Interpreter ABI Platform Actions
parsefabric-1.0.1-py3-none-any.whl Python 3 none any Details for parsefabric-1.0.1-py3-none-any.whl

Total release size: 209.9 kB

Release files / parsefabric-1.0.1.tar.gz

Download URL parsefabric-1.0.1.tar.gz
Size 93.8 kB
Tags Source
SHA-256 checksum
How to use checksums
54fb9ddebc9274a0a27cf1a9533d66f2350479a21bc582ad1f66058ee491a5f4
BLAKE2b-256 checksum
How to use checksums
c6b74ca00f65f5922992a66b47ed674fdbf38d95a4416135052cac6ef4694672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / parsefabric-1.0.1-py3-none-any.whl

Download URL parsefabric-1.0.1-py3-none-any.whl
Size 116.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2115abeef4a5a191ded0764c1b2416c71968bd8cb8b8541e84ff2e6457597520
BLAKE2b-256 checksum
How to use checksums
23a8f6fe56f423d14a1f5522b662363ed85f972d63d1b66a9894e154ec1922a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for parsefabric 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page