Skip to main content

Temporal event-pattern matching over partitioned, timestamped event sequences, with explicit semantics and near-miss explanations.

Project description

epigrep

Temporal event-pattern matching over partitioned, timestamped event sequences — grep-like matching for "what happened, in what order, within what time" — with explicit semantics and near-miss explanations.

Give me partitioned timestamped events and a temporal pattern; I will return spans, captures, and explanations with explicit semantics.

Install

This package is not yet published to PyPI/TestPyPI. In the 0.1 RC work area, install from a local wheel built by maturin:

maturin build --release --manifest-path crates/epigrep-py/Cargo.toml --out dist
python -m pip install --no-index --find-links dist epigrep

Quick Start

from epigrep import Event, Pattern, explain, match, schema

stream = [
    Event("api-0", 0, "config_reload", {"pod": "api-0"}),
    Event("api-0", 30, "readiness_success", {"pod": "api-0"}),
    Event("api-0", 70, "oom_killed", {"pod": "api-0"}),
    Event("api-1", 0, "config_reload", {"pod": "api-1"}),
    Event("api-1", 90, "oom_killed", {"pod": "api-1"}),
]

pattern = (
    Pattern.event("config_reload")
    .then("oom_killed", within=120, no="readiness_success")
    .build()
)

for m in match(pattern, stream):
    print(m.partition, list(m.indices), dict(m.captures))   # api-1 [3, 4] {}

# Why didn't the others match?
for nm in explain(pattern, stream):
    print(nm.partition, nm.reason)                # api-0 absence_blocked

schema(stream) summarises the event types and attributes available; match(...) runs a pattern (compiled by default, exhaustive= and oracle= flags available); explain(...) returns near-misses with structured detail. Pandas dataframe helpers are available when pandas is installed; matching and explanation do not require pandas.

Programmatic / agent use

Patterns round-trip through a stable JSON AST, the recommended interface for tools and LLMs (emit/validate a structured pattern rather than DSL text):

from epigrep import Pattern, pattern_from_json

ast = Pattern.event("A").then("B", within=5).build().to_json()
pattern = pattern_from_json(ast)   # validated; safe to match

parse_pattern(...) remains importable for demos and experiments, but the text DSL is provisional and outside the 0.1 stability guarantee.

Semantics

Matching has an explicit, tested contract (ordering and tie-breaking, partitioning, match-consumption modes, inclusive windows, absence-between, capture/register equality, overlapping matches, and near-miss guarantees). A naive oracle matcher is the source of truth; a compiled matcher is checked against it by property tests.

Status

Alpha (0.1). The Python API and JSON AST are the intended stable surface; the text DSL is experimental. MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epigrep-0.1.0rc1.tar.gz (44.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

epigrep-0.1.0rc1-cp39-abi3-win_amd64.whl (311.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (470.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (464.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

epigrep-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl (412.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file epigrep-0.1.0rc1.tar.gz.

File metadata

  • Download URL: epigrep-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for epigrep-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 55a173f5718bf7c8f2975a5a6d0bb16afcb6ec3186e82c5e9792cc4c0c8ba6fc
MD5 6bdc1e1f9a084c3e51cea28c86e23887
BLAKE2b-256 343fa67697cb7a810dff3ae98e2eaa7843d1cb201c0b7b0358d9642d674ddf6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for epigrep-0.1.0rc1.tar.gz:

Publisher: release.yml on rikkhill/epigrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epigrep-0.1.0rc1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: epigrep-0.1.0rc1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 311.5 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for epigrep-0.1.0rc1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 415a20cae706fc56a15204337f3e4b385ad475effecd766f4533cf1f55fd8156
MD5 b8d066feb59bc42a1de937e5cd76c5e4
BLAKE2b-256 94c649e0ce2e82825fc91364fb3e3059528de94a13a85af41a7e479d78e5e67b

See more details on using hashes here.

Provenance

The following attestation bundles were made for epigrep-0.1.0rc1-cp39-abi3-win_amd64.whl:

Publisher: release.yml on rikkhill/epigrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc39609fb0e896ac1fbf82d9778076faa5821bfb97809a8e09e806595eff55a5
MD5 c8ad31999b2fd909a1c26c151138d844
BLAKE2b-256 5138f390c7afb19d1a6a5606d1b8e47219e80733f81bc6ad31c8ea1e5bc5cb83

See more details on using hashes here.

Provenance

The following attestation bundles were made for epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on rikkhill/epigrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 023e5a1b1b2278b4d9e8717aeac35479b4d55a4acefae47f29047371ea4a73a5
MD5 ac9bafcb6c44230c65a49c50401510d0
BLAKE2b-256 ca1d4d0d364e61b3842a8cf264902539a997bb706c3ba8ac8ac55f8816137d3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for epigrep-0.1.0rc1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on rikkhill/epigrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file epigrep-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for epigrep-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c9d8eb06b3c8c77aaf2c7edfc2536157ad4328c1c1a7343f1fe18fc42369636
MD5 7d32f7cde87ae86c55b009637a1e4495
BLAKE2b-256 9c536859cb6c0d5b6cad5da6ae219741781a1096e89473f2554d4e5aef3ba4b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for epigrep-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on rikkhill/epigrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page