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 inctx.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
- Source: https://github.com/combycode/dpe/tree/main/frameworks/python
- Monorepo: https://github.com/combycode/dpe
- Issues: https://github.com/combycode/dpe/issues
- Changelog: https://github.com/combycode/dpe/blob/main/CHANGELOG.md
- Licence: AGPL-3.0-or-later
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
495bc7d913c4dcf89d857fe08ca8f301b4ad0bbf7bd0c696477d62e1358ada6f
|
|
| MD5 |
9d2b82bb0e8fcb7e250744d03c58e361
|
|
| BLAKE2b-256 |
aa6b9d0397c643489c5472d62e476a1f23d84bceac603a0e12a97a8f79e8ff6e
|
Provenance
The following attestation bundles were made for combycode_dpe-2.0.4.tar.gz:
Publisher:
release.yml on combycode/dpe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
combycode_dpe-2.0.4.tar.gz -
Subject digest:
495bc7d913c4dcf89d857fe08ca8f301b4ad0bbf7bd0c696477d62e1358ada6f - Sigstore transparency entry: 2082033775
- Sigstore integration time:
-
Permalink:
combycode/dpe@4e37fe1f96d7c59ed9187affa54c75dec1cc6fdb -
Branch / Tag:
refs/tags/v2.0.4 - Owner: https://github.com/combycode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e37fe1f96d7c59ed9187affa54c75dec1cc6fdb -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af958df762875c56061a83d5572f816b822e1f1e4d2f884de54e9fb46d7cc1b0
|
|
| MD5 |
e12c71b30f7db8d3e1eb2e8af58f6438
|
|
| BLAKE2b-256 |
6817f3d8e951a49c8458ab97d0403ea6573d29fa7309c57afb2edde1c8ede615
|
Provenance
The following attestation bundles were made for combycode_dpe-2.0.4-py3-none-any.whl:
Publisher:
release.yml on combycode/dpe
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
combycode_dpe-2.0.4-py3-none-any.whl -
Subject digest:
af958df762875c56061a83d5572f816b822e1f1e4d2f884de54e9fb46d7cc1b0 - Sigstore transparency entry: 2082033847
- Sigstore integration time:
-
Permalink:
combycode/dpe@4e37fe1f96d7c59ed9187affa54c75dec1cc6fdb -
Branch / Tag:
refs/tags/v2.0.4 - Owner: https://github.com/combycode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4e37fe1f96d7c59ed9187affa54c75dec1cc6fdb -
Trigger Event:
push
-
Statement type: