skillfed

subprocrunner

A Python wrapper library for subprocess module.

subprocrunner v2.0.1 228.8K downloads/30d#9,144 on PyPI24
Permissive license MIT License AGING released

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 subprocrunner

uv

uv add subprocrunner

poetry

poetry add subprocrunner

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

subprocess wrapperrun external commands pythoncapture command outputsubprocess retry logiccommand execution helpershell command wrapperprocess return code handling
subprocess-wrappercommand-execution

More Libraries packages