Skip to main content

DPE framework for building streaming pipeline tools in Python

Project description

combycode-dpe (Python)

DPE framework for building streaming pipeline tools in Python.

A DPE tool is an independent program: it reads NDJSON envelopes from stdin, processes each one, and writes NDJSON envelopes to stdout. The runner (dpe) spawns it, pipes data through it, and routes its output to the next stage. The framework handles the loop, the parsing, the queues, and the error/trace plumbing — your code only writes the transform.

Requires Python 3.11+.

Install

pip install combycode-dpe
# or in a per-tool venv:
uv venv --seed .venv && .venv/bin/pip install combycode-dpe

Hello tool

# src/my_tool/main.py
import dpe

def process_input(v, settings, ctx):
    ctx.output(v)  # pass-through

if __name__ == "__main__":
    dpe.run()

Run as a tool: python src/my_tool/main.py '{"...settings JSON..."}'. The runner passes settings as argv[1] and pipes NDJSON through stdin/stdout.

dpe.run() introspects the calling module to find process_input and any process_<queue> handlers — no manual registration needed.

Processor signature

def process_input(v, settings, ctx):
    ...
  • v — envelope payload (a dict / list / scalar — whatever JSON parsed to).
  • settings — argv[1] parsed once at startup.
  • ctx — emits output, errors, logs, metadata; reads/writes shared accumulators in ctx.memory.

Internal queues

import dpe

def process_input(v, settings, ctx):
    ctx.emit("validate", v)

def process_validate(v, settings, ctx):
    if v.get("ok"):
        ctx.output(v)
    else:
        ctx.error(v, "validation failed")

if __name__ == "__main__":
    dpe.run()

ctx.emit(queue, v) enqueues for the named handler. ctx.drain() blocks until every queue is empty.

Context API (essentials)

Call What it does
ctx.output(v, id=None, src=None) Emit {t:"d",...} to stdout. id/src default to inherit.
ctx.emit(queue, v) Push to internal queue, processed by process_<queue>.
ctx.drain() Block until all queues are empty.
ctx.error(v, msg) Write {type:"error",input:v,error:msg,...} to stderr.
ctx.log(level, msg) Structured stderr log.
ctx.meta(v) Emit {t:"m", v} envelope to stdout.
ctx.memory Typed accumulators: Number, Average, MinMax, Set, Map, Buffer, Boolean, BitMask, Trigger.

See docs/frameworks.md in the monorepo for the full reference.

Scaffolding

dpe-dev scaffold --name my-tool --runtime python --out ./my-tool --description "what it does"
cd my-tool
dpe-dev build .   # creates .venv, installs the tool with [dev] extras
dpe-dev test  .   # pytest inside the venv

End-to-end stage testing happens via dpe test <pipeline>:<stage> once the tool is wired into a pipeline — see docs/testing.md.

Optional speed-up

For bulk-hashing payloads, install xxhash and pass algorithm="xxhash" to dpe.hash_file(). The framework falls back to hashlib.blake2b when xxhash is missing.

Repo & licence

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

combycode_dpe-2.0.4.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

combycode_dpe-2.0.4-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file combycode_dpe-2.0.4.tar.gz.

File metadata

  • Download URL: combycode_dpe-2.0.4.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for combycode_dpe-2.0.4.tar.gz
Algorithm Hash digest
SHA256 495bc7d913c4dcf89d857fe08ca8f301b4ad0bbf7bd0c696477d62e1358ada6f
MD5 9d2b82bb0e8fcb7e250744d03c58e361
BLAKE2b-256 aa6b9d0397c643489c5472d62e476a1f23d84bceac603a0e12a97a8f79e8ff6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for combycode_dpe-2.0.4.tar.gz:

Publisher: release.yml on combycode/dpe

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

File details

Details for the file combycode_dpe-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: combycode_dpe-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for combycode_dpe-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 af958df762875c56061a83d5572f816b822e1f1e4d2f884de54e9fb46d7cc1b0
MD5 e12c71b30f7db8d3e1eb2e8af58f6438
BLAKE2b-256 6817f3d8e951a49c8458ab97d0403ea6573d29fa7309c57afb2edde1c8ede615

See more details on using hashes here.

Provenance

The following attestation bundles were made for combycode_dpe-2.0.4-py3-none-any.whl:

Publisher: release.yml on combycode/dpe

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