Registry / devops / subprocrunner

subprocrunner

JSON →
library2.0.1pypypi✓ verified 85d ago

A wrapper library for Python's subprocess module that enhances readability and error handling. Current version 2.0.1 runs on Python >=3.7 with monthly/bimonthly releases.

pip install subprocrunner
INSTALL
IMPORT
SIG · SUBPROCRUNNER
S
subprocrunner
devopspythonv2.0.1
Install
2.5s avg
Import
48ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.052s · 34.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.5s · import 0.044s · 35MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SubprocessRunner
from subprocrunner import SubprocessRunner
from subprocrunner import SubprocessRunner as SR
Aliasing is unnecessary; the class is already short.

Run a shell command and capture stdout.

from subprocrunner import SubprocessRunner runner = SubprocessRunner('echo Hello, world!') runner.run() print(runner.stdout)
Debug
Known issues
breakingIn version 2.0.0, the `run()` method no longer returns a tuple (returncode, stdout, stderr). It now returns a `SubprocessRunner` instance. Access output via attributes `returncode`, `stdout`, `stderr`.
fix
Update code from `returncode, stdout, stderr = runner.run()` to `runner.run(); returncode, stdout, stderr = runner.returncode, runner.stdout, runner.stderr`.
affects: <2.0.0
gotchaBy default, `run()` raises `CalledProcessError` for non-zero exit codes. Set `raise_exception=False` to suppress this.
fix
Use `runner.run(raise_exception=False)` to handle errors manually.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'subprocrunner'
Library not installed.
fix
Run `pip install subprocrunner`.
AttributeError: 'NoneType' object has no attribute 'stdout'
Trying to access stdout before running the command.
fix
Call `runner.run()` before accessing `runner.stdout`.
Upgrade
Version history
2.0.1latest on PyPI · released Apr 6, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
Resources
subprocrunner — pip install subprocrunner · libregistry