sh
Python subprocess replacement
Decision gist · record as of 2026-08-14
Yes. sh is actively maintained, has no dependencies, installs with low friction, carries no known vulnerabilities, and solves a real pain point in subprocess handling. Install it if you regularly call Unix programs from Python and prefer a cleaner syntax than subprocess. Not applicable on Windows.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Unix-like operating system required (Linux, macOS, BSD); Windows is not supported.
- Low friction—pure Python wheel with no runtime dependencies.
- Actively maintained with a recent release (20 days ago) and 7245 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2026-07-25 (20 days) · last repo commit 2026-07-25 · 7,245 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 12,232,375 downloads/mo, #1,334 on PyPI
Alternatives
Verify before relying
pip install sh
from sh import git
print(git("status", "--short"))- Whether the package handles shell metacharacters and escaping automatically or requires manual quoting.
- Performance characteristics compared to subprocess.run() for high-volume command execution.
- Behavior when called programs write to stderr or exit with non-zero status codes.
What it is and what it does
sh is a subprocess wrapper that lets you import and call Unix programs directly as Python functions, eliminating the need to construct command strings or manage subprocess objects manually. Instead of writing subprocess code, you write `from sh import git; git('status', '--short')`. The package is designed for Unix-like systems only (Linux, macOS, BSD) and does not support Windows.
It works by dynamically creating callable objects that map to system programs and handling the underlying process spawning, argument passing, and output capture. With no external dependencies and a pure-Python implementation, it installs cleanly and runs on Python 3.10 through 3.14 and PyPy. The interface is intentionally simple: it is not a reimplementation of Unix tools in Python, but a thin layer that makes calling existing programs feel native to Python code.
Use it for
- Automating git workflows in deployment or CI scripts by calling git commands directly as functions.
- Building command-line tools that orchestrate multiple system utilities without subprocess boilerplate.
- Writing system administration scripts that invoke tools like grep, sed, or find with natural Python syntax.
- Testing shell scripts or system behavior from Python test suites by invoking the actual programs.
- Capturing and processing output from external programs in data pipelines or build systems.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
sh is actively maintained, has no dependencies, installs with low friction, carries no known vulnerabilities, and solves a real pain point in subprocess handling. Install it if you regularly call Unix programs from Python and prefer a cleaner syntax than subprocess. Not applicable on Windows.
Install
sh on PyPI
Before you install
Low friction—pure Python wheel with no runtime dependencies. Actively maintained with a recent release (20 days ago) and 7245 repository stars.
Unix-like operating system required (Linux, macOS, BSD); Windows is not supported.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install sh
from sh import git
print(git("status", "--short"))
Verify before relying
- Whether the package handles shell metacharacters and escaping automatically or requires manual quoting.
- Performance characteristics compared to subprocess.run() for high-volume command execution.
- Behavior when called programs write to stderr or exit with non-zero status codes.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 20 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,232,375 / month, #1,334 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries :: Python Modules |
Evidence: sh-2.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “subprocess replacement”
- shCalls any Unix program as a Python function, replacing subprocess…
- subprocess32A backport of Python 3's subprocess module to Python 2, with…
- subprocess-teeA drop-in replacement for subprocess.run that captures output while…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also EasyProcess · subprocess-tee · runs · executor · subprocess.run · ptyprocess · subprocess-multitee · subprocess32 · fabric · sarge