ParseFabric
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.
- Provenance. Optionally record which parser produced which events from which source, through a small recorder contract or the agxai adapter.
- Replace any part. Aggregators, codecs, partitioners, execution
backends, sinks, provenance recorders, 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
Optional extras add integrations:
pip install "parsefabric[langchain]" # LangChain and LangGraph tools and runnables
pip install "parsefabric[agxai]" # provenance recorded with agxai
pip install "parsefabric[all]" # every integration
ParseFabric supports Python 3.12, 3.13, 3.14 and 3.15 on Linux, macOS and Windows.
Every engine operation takes one request object, such as ParseRequest or
BatchParseRequest. Coming from 1.x? See
Upgrading to 2.0.
Quick example
import asyncio
from parsefabric import (
AggregateRequest,
MaterializeRequest,
ParseContext,
ParseEngine,
ParseRequest,
)
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(ParseRequest(parser=parser, source=LOG, context=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(AggregateRequest(parser=parser, events=result.events))
stored = await engine.serialize(aggregates)
restored = await engine.materialize(
MaterializeRequest(
parser=parser,
source=LOG,
aggregates=await engine.deserialize(stored),
context=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, ParseRequest
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(ParseRequest(parser=parser, source=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
Batches and streams
import asyncio
from parsefabric import BatchParseRequest, ParseContext, ParseEngine, ParseInput
from parsefabric.builtins import ApplicationLogParser
from parsefabric.execution import ThreadExecutionBackend
FILES = {
"api.log": "2026-10-04T08:15:04Z ERROR upstream timed out after 5s\n",
"web.log": "2026-10-04T08:15:05Z WARN disk 91% full\n",
}
async def main() -> None:
async with ThreadExecutionBackend(max_workers=4) as backend:
engine = ParseEngine(backend=backend, timeout=30)
request = BatchParseRequest(
parser=ApplicationLogParser(),
inputs=[ParseInput(text, ParseContext(source_id=name)) for name, text in FILES.items()],
max_concurrency=4,
continue_on_error=True,
)
for result in await engine.parse_batch(request):
print(result.events[0].evidence.source_id, [e.event_type for e in result.events])
asyncio.run(main())
Output:
api.log ['timeout', 'error']
web.log ['warning']
How it fits together
Downloads
Download counts come from the public ClickHouse PyPI dataset, which refreshes daily. Shields caches badge images for up to an hour, and GitHub may cache them longer. Weeks start on Monday (UTC). Explore interactive charts on the ClickPy dashboard.
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 |
| Threads, processes, timeouts and custom backends | Execution |
| Recording lineage, including with agxai | Provenance |
| Moving from 1.x | Upgrading to 2.0 |
| 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 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| parsefabric-2.0.0.tar.gz | 107.4 kB | Without provenance | Details for parsefabric-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| parsefabric-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for parsefabric-2.0.0-py3-none-any.whl |
Total release size: 234.6 kB
Release files / parsefabric-2.0.0.tar.gz
| Download URL | parsefabric-2.0.0.tar.gz |
|---|---|
| Size | 107.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3a3b48278cbffbc738e633efb0623f283bb62d51549bebd5e2554e410fcd58d
|
|
BLAKE2b-256 checksum How to use checksums |
15cb70c83f1181f467aad435e17f127ca11503d0ab656828b3284f994460ed72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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-2.0.0-py3-none-any.whl
| Download URL | parsefabric-2.0.0-py3-none-any.whl |
|---|---|
| Size | 127.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef986f72d2ce6e5ae2634628575367d4391fad05c66d4d716afeabd273f40927
|
|
BLAKE2b-256 checksum How to use checksums |
124841a3f127bb569e2fff7e96b1e47dd3f0fd0d0048f25b4a34cbc5f00adffd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 2.0.0
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.