Skip to main content

Python subprocess replacement

Project description

Logo

If you are migrating from 1.* to 2.*, please see MIGRATION.md


Version Downloads Status Python Versions Coverage Status

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

from sh import ifconfig
print(ifconfig("eth0"))

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

Installation

$> pip install sh

Support

Developers

Testing

Tests are run in a docker container 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

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sh-2.2.0.tar.gz (345.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sh-2.2.0-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file sh-2.2.0.tar.gz.

File metadata

  • Download URL: sh-2.2.0.tar.gz
  • Upload date:
  • Size: 345.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for sh-2.2.0.tar.gz
Algorithm Hash digest
SHA256 6a8ca54a3a3cd5ec2ccdee64e6e25ff543e1ccd4f5b5e83d75d8a8f6b57e6a00
MD5 811c192253fbb78514413a2b42ff641e
BLAKE2b-256 8e1ee062e62f82c3cf8a6cdb92afac3a5ecffd70565b2aa2a3bd692f92ae1ac8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sh-2.2.0.tar.gz:

Publisher: main.yml on amoffat/sh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sh-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: sh-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for sh-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd5f3c3092566c31e7ff394ffde306fb0c2515f83c5ee242f8e95758601263bf
MD5 9061a35cb8a44b87cc1bc68b792a6b19
BLAKE2b-256 257e5459bcae3b8da17ea677519a859da175a3b582977aa84eb0e06411a635ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for sh-2.2.0-py3-none-any.whl:

Publisher: main.yml on amoffat/sh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page