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

Uploaded Source

Built Distribution

sh-2.0.5-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sh-2.0.5.tar.gz
  • Upload date:
  • Size: 44.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sh-2.0.5.tar.gz
Algorithm Hash digest
SHA256 9d9e59498da2871c51d6170a8815da83a72c2c2d29f335e7abf0202e1a8fdb7f
MD5 f6388a345a963044f4ba6bf3e7bf9697
BLAKE2b-256 3786ece11098f49068b8e77a46b83bce8e539b9416cfc03f2fab287f92d7230f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sh-2.0.5-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sh-2.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a52f6e064919fdf198c7383ccdd570fe0acde74b92bc7149863c1fe652ab7e11
MD5 3e06bdede79f62ed49f49098b9760c7c
BLAKE2b-256 70742e736bba864003888345b985e347d36de4f3b77757b5169281eaf38de2ce

See more details on using hashes here.

Supported by

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