Skip to main content
Logo Version Downloads Status Python Versions Coverage Status

sh is a full-fledged subprocess replacement for Python 3.10 - 3.14, and PyPy that allows you to call any program as if it were a function:

from sh import git
print(git("status", "--short"))

sh is not a collection of system commands implemented in Python.

sh relies on various Unix system calls and only works on Unix-like operating systems - Linux, macOS, BSDs etc. Specifically, Windows is not supported.

Complete documentation here

Full documentation on a single page for LLM-assisted coding here

Installation

$> pip install sh

Support

Developers

Open the repo in a devcontainer in VScode, or in a codespace on Github.

Open in GitHub Codespaces

Testing

Tests are run by tox against all supported Python versions. To run, make the following target:

$> make test

To run a single test:

$> make test='FunctionalTests.test_background' test_one

Docs

To build the docs, make sure you’ve run poetry install to install the dev dependencies, then:

$> cd docs
$> make html

This will generate the docs in docs/build/html. You can open the index.html file in your browser to view the docs.

Coverage

First run all of the tests:

$> SH_TESTS_RUNNING=1 coverage run --source=sh -m pytest

This will aggregate a .coverage. You may then visualize the report with:

$> coverage report

Or generate visual html files with:

$> coverage html

Which will create ./htmlcov/index.html that you may open in a web browser.

Release files for sh 2.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sh 2.4.0
File Size Uploaded
sh-2.4.0.tar.gz 136.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sh 2.4.0
File Interpreter ABI Platform
sh-2.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 185.6 kB

Release files / sh-2.4.0.tar.gz

Download URL sh-2.4.0.tar.gz
Size 136.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a250aef68509ed93419c9a1d90b0647cd5cbe26107ba94d3717ef5b6d595ffd9
BLAKE2b-256 checksum
How to use checksums
e9c8137093889a8b8c9a66c9b46079cf2a0e155a8be027df212a4041e3b7b09c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 25, 2026.

Transparency log

Release files / sh-2.4.0-py3-none-any.whl

Download URL sh-2.4.0-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98eba32eeb5ecdd310668737d7461e668afc42b273550d0bc198a1c5c2b1ab36
BLAKE2b-256 checksum
How to use checksums
23dd6b9aceecddbb3df894003d6a5005bd90bce3cf4743c28c406ebecc8d80f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.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 Jul 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.4.0 This release

2 release files

2.3.0

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.14.3

1 release file

1.14.2

2 release files

1.14.1

2 release files

1.14.0

2 release files

1.13.1

2 release files

1.13.0

2 release files

1.12.8

2 release files

1.12.3

2 release files

1.12.2

2 release files

1.12.1

2 release files

1.12.0

2 release files

1.11

1 release file

1.10

1 release file

1.09

1 release file

1.08

1 release file

1.07

1 release file

1.06

1 release file

1.05

1 release file

1.04

1 release file

1.03

1 release file

1.02

1 release file

1.01

1 release file

1.0

1 release file

0.108

1 release file

0.107

1 release file

0.106

1 release file

0.01

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page