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.11, 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.

Project details


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.1.0.tar.gz (345.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sh-2.1.0.tar.gz
  • Upload date:
  • Size: 345.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sh-2.1.0.tar.gz
Algorithm Hash digest
SHA256 7e27301c574bec8ca5bf6f211851357526455ee97cd27a7c4c6cc5e2375399cb
MD5 eba6bd8ec843a707bdc481577835980d
BLAKE2b-256 5212b7965006c5adc57ba5459385358bd27c4983cd490884a75be86eb1d3efeb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sh-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5e44178dd96a542126c2774e9b7ab1d89bfe0e2ef84d92e6d0ed7358d63d01
MD5 626a32ccbd12ccb40c1ea2fa7b1f2806
BLAKE2b-256 0059f6551f49c123751e921038c24215157bd50aef375ced16cac57229678c43

See more details on using hashes here.

Supported by

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