This release is a pre-release and may not be stable for production use.
🔧 cuprum
Typed, async command execution for Python—so you can ditch the shell scripts without losing your mind.
Cuprum runs a known set of external programs from Python without ever building a shell command string. You say which programs are allowed, build argument lists with ordinary Python values, and get a structured result back from every run.
Website: https://df12.studio/cuprum
Why cuprum?
If you've ever written a Python script that calls out to external commands,
you've probably experienced the joys of subprocess: stringly-typed arguments,
mysterious failures, and output that vanishes into the void. Cuprum is here to
help.
- No shell roulette: You build argument vectors for approved executables, so there are no command strings to quote, escape, or get wrong.
- You choose what runs: A catalogue decides which programs can be built into commands. Use the default one, or define your own with project metadata. An optional execution scope narrows things further at run time.
- Answers, not guesswork: Every completed run returns a structured result, so success, failure, and output are right there to inspect.
- Async when you want it: Cuprum is async-first, with synchronous wrappers for scripts that don't need an event loop.
Whether you're building deployment helpers, CI glue, or maintenance scripts, we want "Python instead of Bash" to feel like an upgrade rather than a chore.
Quick start
Installation
Cuprum needs Python 3.12 or newer, and runs on Linux, macOS, and Windows.
This README and the guides describe Cuprum 0.2.0, which is currently in beta.
Installers skip prereleases unless asked, so a bare pip install cuprum would
fetch the older 0.1.0 release instead. Ask for the beta explicitly with pip:
python -m pip install "cuprum>=0.2.0b2"
Or add it to a uv project:
uv add "cuprum>=0.2.0b2"
The same requirement keeps working once 0.2.0 itself is released.
Quick taste
This example approves the Python interpreter that is running it, so it works on any machine without assuming which other tools are installed:
import asyncio
import sys
from cuprum import Program, ProgramCatalogue, sh
catalogue = ProgramCatalogue.from_programs(sys.executable, name="quick-start")
python = sh.make(Program(sys.executable), catalogue=catalogue)
command = python("-c", "print('hello, cuprum!')")
async def main() -> None:
result = await command.run()
assert result.ok and result.stdout == "hello, cuprum!\n"
asyncio.run(main())
Four small pieces did the work there:
ProgramCatalogue.from_programs()approved one program.sh.make()checked that approval and returned a builder.- Calling the builder produced a command: an argument vector, not a string.
run()started the child and returned aCommandResult.
Prefer to skip the event loop? command.run_sync() returns the same result.
Where next?
- New to Cuprum? The users' guide picks up where this example stops, one task at a time: handling failure, controlling output, input and deadlines, pipelines, and policy.
- Replacing
subprocesscalls? Start at Migrate a caller, which sets asubprocess.run()call beside its Cuprum equivalent. - Upgrading from Cuprum 0.1? The 0.2.0 migration guide lists the breaking changes first, each with the fix.
Features
- Catalogue-backed builders – Unknown programs raise
UnknownProgramErrorbefore anything runs (run a command). - Structured results – Exit code, process ID, captured output, timing,
resource measurements where the platform supports them, and a handy
okproperty (handle failure). - Output your way – Capture, echo, per-line observation, byte-exact capture, and an optional heartbeat for quiet children can each be switched on independently, or a stream can go straight to a file (control output).
- Input of any size – Send a small payload in one go, or stream a large one from an async producer, with backpressure (stream input).
- Graceful cancellation – Cancelled or timed-out runs terminate the child,
wait for a configurable grace period, then force-kill it (
SIGKILLon POSIX). Opt in to process-group ownership to reclaim the child's descendants too (handle a slow command). - Hands on the wheel –
start()returns a handle to a running child, so your code decides when to wait, signal, or stop it (hold a running child). - Composition – Build pipelines, or run commands concurrently with a bounded level of parallelism (connect a pipeline).
- Context policy – Scoped allowlists, environment policies, executable bindings, and hooks keep each part of your application to the commands it should use (apply a policy).
- Observability – Lifecycle events, with adapters for structured logging, metrics, and tracing, plus framed output on GitHub Actions and opt-in redaction of secrets from what they export (log, measure, and trace runs).
- Optional acceleration – A Rust extension speeds up stream handling between pipeline stages; the pure Python installation has no runtime dependencies at all (choosing a stream backend).
Status
Cuprum 0.2.0 is in beta. The command runtime, scoped allowlists, hooks, and the optional native stream backend are all in place, and the examples in this README and the guides are executed by the test suite. The public API may still change before a stable 1.0 release, so pin the version you depend on and read the changelog and migration guide when you upgrade.
Learn more
- Users' guide — from a first command to pipelines, policy, telemetry, and troubleshooting
- 0.2.0 migration guide — upgrading an existing application
- Changelog — what changed in each release
- Roadmap — planned features and progress
- Developers' guide — building, testing, and maintaining cuprum
About the name
The name is a tip of the hat to Plumbum, the library that showed us shell-like scripting in Python could actually be pleasant. "Cuprum" is Latin for copper—another metal used in pipes—and we hope to carry that spirit forward with a focus on type safety and explicit allowlists.
Licence
ISC — see LICENSE for details.
Contributing
Contributions are welcome! Start with the developers' guide for how to build and test the project; automated contributors should also follow AGENTS.md.
Metadata
Release files for cuprum 0.2.0b2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cuprum-0.2.0b2.tar.gz | 535.7 kB | With provenance | Details for cuprum-0.2.0b2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| cuprum-0.2.0b2-py3-none-any.whl | Python 3 | none | any | Details for cuprum-0.2.0b2-py3-none-any.whl |
| cuprum-0.2.0b2-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for cuprum-0.2.0b2-cp312-abi3-win_amd64.whl |
| cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_x86_64.whl |
| cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_aarch64.whl |
| cuprum-0.2.0b2-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for cuprum-0.2.0b2-cp312-abi3-macosx_11_0_arm64.whl |
| cuprum-0.2.0b2-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details for cuprum-0.2.0b2-cp312-abi3-macosx_10_12_x86_64.whl |
Total release size: 4.7 MB
Release files / cuprum-0.2.0b2.tar.gz
| Download URL | cuprum-0.2.0b2.tar.gz |
|---|---|
| Size | 535.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
325cc0e4d025f313ce09aece37a71267e590848536f6847a986eebf53b0331e3
|
|
BLAKE2b-256 checksum How to use checksums |
ecb7d933ba32a658cef81b6c1aaefb2c938dea836c5ea0e1549092cca609ecf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-py3-none-any.whl
| Download URL | cuprum-0.2.0b2-py3-none-any.whl |
|---|---|
| Size | 517.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
723518f51e6242e04c6c7ce4ab4b31bf09d0bfa0b57b75d3c61dc23835db13bf
|
|
BLAKE2b-256 checksum How to use checksums |
54b896703f2ff979d21a75c0d860de09caf99503f12191500625955f3aed5331
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-cp312-abi3-win_amd64.whl
| Download URL | cuprum-0.2.0b2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 629.2 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c3258d254d7495797f06ed4eb23f46580f2bcc801f0ef56862d17644c0aefe0d
|
|
BLAKE2b-256 checksum How to use checksums |
bde12462d575c80d50e550c0178382689e934f45b59b306d8d1534b6a6ba4faa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 779.7 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4fe9621790634e350e5735ddf3cb400247976bb565f72548e478049e9c1b839a
|
|
BLAKE2b-256 checksum How to use checksums |
1d86dd7fae1e28a2fed4851c3956b86eda9737728203e3d3d1cf61ead1999b98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | cuprum-0.2.0b2-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 781.3 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
dfe32d6602c64a1513a2bf4bfe8a8a3f64c195b43df5fc670925c5fe1be34929
|
|
BLAKE2b-256 checksum How to use checksums |
5b7ded30accf7f030bb7409b68b7b8fe6c229956930e205166cb5b31cfd9dd09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | cuprum-0.2.0b2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 739.1 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
07e7087d3e7a6beaac460eb065eafd4326e317514f00e50876b630c88c3fbc83
|
|
BLAKE2b-256 checksum How to use checksums |
ec9311bb25c6485fd232f9970427571329e5994f234140e3e9fc7cf633eee18a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / cuprum-0.2.0b2-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | cuprum-0.2.0b2-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 740.6 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
bcdfd81e870dbe7f5cf03f88b76c95b9e9a6387e8962f45ca0bd875e5e9c7bc2
|
|
BLAKE2b-256 checksum How to use checksums |
3f1aefb78849a1eaa66a15fa74dbd138068ea1632fa3890f7cfaf6799a114126
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for cuprum 0.2.0b2
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.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for cuprum-0.2.0b2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA 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.