subprocrunner
A Python wrapper library for subprocess module.
What it is and what it does
SubprocessRunner is a thin wrapper around Python's subprocess module that reduces boilerplate when executing external commands. It provides a simple object-oriented interface to run commands, automatically capture stdout and stderr, and access return codes without the ceremony of subprocess.Popen or subprocess.run. The package handles common patterns like retrying failed commands with exponential backoff, raising exceptions on non-zero exit codes, and dry-run mode for testing command sequences without actually executing them.
The library is useful when you need to shell out to external tools from Python code and want cleaner syntax than the standard library offers. It depends only on mbstrdecoder for string handling and supports Python 3.7 through 3.12. The package includes a utility class (Which) to check if a command exists on the system and locate its absolute path, and can optionally log activity via loguru if installed.
Use it for:
- Run shell commands from Python scripts and capture their output without writing subprocess boilerplate.
- Implement retry logic for flaky external commands with configurable backoff and jitter.
- Test command sequences in dry-run mode before actually executing them.
- Build command-line tool wrappers that need to validate return codes and raise exceptions on failure.
- Track execution history of all commands run during a session for debugging or auditing.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps Python's subprocess module to simplify running external commands, capturing output, handling retries, and checking return codes.
Yes, if you frequently run external commands and want cleaner syntax than subprocess.Popen or subprocess.run. The low install friction, permissive license, and stable API make it a safe choice. The aging maintenance (860+ days since last release) is not a blocker for stable use cases, but verify compatibility with your Python version and consider whether you need active development support before adopting.
Install
subprocrunner on PyPI
pip
pip install subprocrunneruv
uv add subprocrunnerpoetry
poetry add subprocrunnerInstalling subprocrunner
Before you install
Low friction install with a single runtime dependency (mbstrdecoder). Maintenance status is aging—last release was in April 2024 and no updates in over 860 days—but the repository remains active and the package is marked Production/Stable.
License in practice
MIT License (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install subprocrunner
from subprocrunner import SubprocessRunner
runner = SubprocessRunner(["echo", "test"])
print(f"return code: {runner.run()}")
print(f"stdout: {runner.stdout}")
Verify before relying
- Whether the aging maintenance status (860+ days since last release) affects stability or compatibility with current Python versions.
- Performance characteristics when running many commands or handling large output streams.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — mbstrdecoder |
| Maintenance | aging — 860 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 228,762/month — #9,144 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: subprocrunner-2.0.1-py3-none-any.whl
Keywords: library, subprocess
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
EasyProcessEasyProcess wraps Python's subprocess module to…
permissive · top 5,000 on PyPI
executorWraps Python's subprocess module to simplify…
permissive · top 15,000 on PyPI
runezA zero-dependency utility library providing…
permissive · top 5,000 on PyPI
bashProvides a Python wrapper for running bash…
copyleft · top 15,000 on PyPI
runsRuns multiple subprocess commands from a text…
permissive · top 5,000 on PyPI
fancy-subprocessRuns shell commands with formatted output,…
permissive · top 15,000 on PyPI
delegator.pyDelegator.py wraps subprocess execution with a…
permissive · top 15,000 on PyPI
subprocess-multiteeMultiplexes subprocess stdout/stderr to…
unclear · top 15,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
shellescapeProvides a `quote()` function that…
permissive · top 5,000 on PyPI