monopipe
Multiplex a command's stdout, stderr, and exit code into a single ordered JSONL stream — and demultiplex it back into the original channels.
Why?
When you capture a program's output to a file or send it down a pipe, you lose information: stdout and stderr collapse into one undifferentiated blob (or one of them is thrown away), the interleaving order is muddied, and the exit code vanishes entirely. monopipe records all of it — both channels, in arrival order, plus the return code — as one line-delimited JSON stream you can store, transport, or process, then replays it faithfully into real stdout and stderr later.
It runs like the time command: put monopipe in front of any command.
Quick Start
Install
pip install monopipe
Or run directly with uv:
uvx monopipe -- your-command --flag
Capture
monopipe ./build.sh --verbose > run.jsonl
This runs ./build.sh --verbose and writes a JSONL record stream to stdout:
{"start":["./build.sh","--verbose"]}
{"stdout":"Compiling...\n"}
{"stderr":"warning: unused variable\n"}
{"stdout":"Done\n"}
{"retcode":0}
Split
Feed that stream back in on stdin with -s to demultiplex it:
monopipe -s < run.jsonl # stdout → stdout, stderr → stderr
echo $? # → the original command's exit code
The Format
One JSON object per line, each (when produced by monopipe) carrying exactly one key:
| Key | Value |
|---|---|
start |
array of strings — the command and its arguments |
stdout / stderr |
string — a chunk of output, when it is valid UTF-8 |
stdout_b64 / stderr_b64 |
string — base64 of the raw bytes, for non-UTF-8 output |
retcode |
integer — the command's exit code |
Text is kept human-readable in the common case; arbitrary binary output falls back to base64 so the round-trip is always byte-exact. Split mode is lenient: it ignores unrecognised keys, accepts multiple recognised keys on one line, and skips lines that carry none.
How It Works
In capture mode, monopipe runs the child with its own stdin forwarded through (so interactive programs and filters still work), reads stdout and stderr concurrently, and emits one record per output line — or per 512 bytes when a line is longer — through a single serialised writer, so the JSONL is always well-formed and streamed in real time. The child's exit code is emitted last as a retcode record.
In split mode, monopipe reads the JSONL on stdin, writes each chunk to the matching channel, and exits with the recorded retcode so it stays transparent in a pipeline.
The binary is a statically-linked Go executable with zero external dependencies — distributed as platform-specific Python wheels via bin2whl, so pip install monopipe needs no Python runtime at execution time.
Licence
Released under the Unlicense — public domain.
Metadata
Release files for monopipe 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| monopipe-1.0.0-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for monopipe-1.0.0-py3-none-win_arm64.whl |
| monopipe-1.0.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for monopipe-1.0.0-py3-none-win_amd64.whl |
| monopipe-1.0.0-py3-none-manylinux_2_17_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for monopipe-1.0.0-py3-none-manylinux_2_17_x86_64.whl |
| monopipe-1.0.0-py3-none-manylinux_2_17_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details for monopipe-1.0.0-py3-none-manylinux_2_17_aarch64.whl |
| monopipe-1.0.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for monopipe-1.0.0-py3-none-macosx_11_0_arm64.whl |
| monopipe-1.0.0-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details for monopipe-1.0.0-py3-none-macosx_10_9_x86_64.whl |
Total release size: 7.2 MB
Release files / monopipe-1.0.0-py3-none-win_arm64.whl
| Download URL | monopipe-1.0.0-py3-none-win_arm64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
5b8cd78354eb7e6a87fad78946d7bce14f39b9c513b4224c9d2c4a185e2647f8
|
|
BLAKE2b-256 checksum How to use checksums |
00e421a7d23391a52b3e1b635df08d17760fe58c9605f1cab14c4e0d344e0a25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Release files / monopipe-1.0.0-py3-none-win_amd64.whl
| Download URL | monopipe-1.0.0-py3-none-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4095153c3492408154f9e6781704b0c2d7b881f3b2383bd797211c138d62781a
|
|
BLAKE2b-256 checksum How to use checksums |
253cffce547c8b055bf5d68cd5c197942537f2069cf253d6e935798a557112f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Release files / monopipe-1.0.0-py3-none-manylinux_2_17_x86_64.whl
| Download URL | monopipe-1.0.0-py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
662f9ebb8478d1647df1bced770ef85c376aee9a2276ba43ff8ea66768b3807b
|
|
BLAKE2b-256 checksum How to use checksums |
0c1a716b1f4d21c3f326884cac77b00086a783973a66022a919b5b0029646cf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Release files / monopipe-1.0.0-py3-none-manylinux_2_17_aarch64.whl
| Download URL | monopipe-1.0.0-py3-none-manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
b653b96bb077e9b8d17c12f66f059aaf24949803df9517037c5d76c9d7323469
|
|
BLAKE2b-256 checksum How to use checksums |
5d67aa9957710a03cfc6277f3da5ce316f0a706fa3d8d7f5efb9a111d8f097bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Release files / monopipe-1.0.0-py3-none-macosx_11_0_arm64.whl
| Download URL | monopipe-1.0.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
21304f4aa0e7ece7100ad3485072f21f5e21e7bfa8aa1d3af76a4a0e6c620fe2
|
|
BLAKE2b-256 checksum How to use checksums |
028f9bc866dfa5d30552994b9fbbaf714b0bbe73367e6fde965f1fafc8525256
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Release files / monopipe-1.0.0-py3-none-macosx_10_9_x86_64.whl
| Download URL | monopipe-1.0.0-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
2e8856cdbad8b4b69bd327fd2f8487fca9241c9fab9706222b84d5aee10fa532
|
|
BLAKE2b-256 checksum How to use checksums |
3c8c7048765233e3539f7688cec4d468028791f04e2fb91f11d0f7bce7cf32fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.15.2
|
Security for monopipe 1.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.