Run JSONL-emitting subprocesses with a consumable async channel
Project description
jsonl-exec
Tiny structured-concurrency helpers for running a subprocess that emits JSON messages on stdout, reports text lines on stderr, and exposes stdout as a consumable async channel.
It intentionally does not parse provider-specific schemas or agent events. It just manages:
- process startup
- stdout JSON line parsing
- stderr callbacks
- async receive queue
- cancellation and process-tree cleanup
Example
from wm_jsonl_subprocess import JsonLineProcessOptions, open_json_line_process
async def main() -> None:
async with open_json_line_process(
JsonLineProcessOptions(
cmd="claude",
args=["-p", "Hello", "--output-format", "stream-json"],
on_stderr=print,
)
) as process:
while True:
message = await process.receive()
if message is None:
break
print(message)
Project details
Release history Release notifications | RSS feed
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 jsonl_exec-0.1.0.tar.gz.
File metadata
- Download URL: jsonl_exec-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82df1dd03e95a73bbb62146e71b2fbffb8e72c4e020ed7505152722e86a37b33
|
|
| MD5 |
ce4772cda2c0ae9cf1c8d7b687126e68
|
|
| BLAKE2b-256 |
136842c60c562857b2cf55470b0fbbcb6b9ca0f6715fd11971bebb77b4cb9da9
|
File details
Details for the file jsonl_exec-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jsonl_exec-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6c9024599e969287de80b24fae5f88b9f59c90a8f8a4ec5f251319f14c445f8
|
|
| MD5 |
38f01de8cc5a1ca21bb5228121dbe74d
|
|
| BLAKE2b-256 |
4ac745283267476ada3e29d9f1aa692413ae545f8cccdc817470c5d9a43b497b
|