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.0.7.tar.gz (345.5 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.0.7-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sh-2.0.7.tar.gz
Algorithm Hash digest
SHA256 029d45198902bfb967391eccfd13a88d92f7cebd200411e93f99ebacc6afbb35
MD5 d6963ecb396045a3ff280baa1fefd79b
BLAKE2b-256 147a5148402146d360a6d15922814a3b065b52be3a5fe878a8834d3ce4e7d33f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for sh-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2f2f79a65abd00696cf2e9ad26508cf8abb6dba5745f40255f1c0ded2876926d
MD5 21feea629be6d9f9cfef3df893c46393
BLAKE2b-256 15c279f9dea6fc544c0eb79ed5018a38860c52d597c4be66c2cf2029bea5b3fd

See more details on using hashes here.

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