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 Build Status Coverage Status

sh is a full-fledged subprocess replacement for Python 3.8 - 3.10, PyPy and PyPy3 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

Updating the docs

Check out the gh-pages branch and follow the README.rst there.

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 unittest

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.2.tar.gz (345.4 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.2-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sh-2.0.2.tar.gz
  • Upload date:
  • Size: 345.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for sh-2.0.2.tar.gz
Algorithm Hash digest
SHA256 364a25cd2380c3170c46718fe3cc6ffc94b36721e30196a064be508f9b3162f4
MD5 d25f38a12edd64f5d3ecb56f5bc76f48
BLAKE2b-256 ffc70c170c7dde31f088f3c8221f90e054b121b5bd36f9e6f94edca4fdb64c0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sh-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for sh-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6208566c168a47ba46a3b5eeda0c9125091c2335f3cbb29f664519f90feb19f
MD5 dad70311b43292c956e29d41e183fbf8
BLAKE2b-256 47bfb0c53e0f2474bb2c9efdeec792051aef0c4e96c1bf58a82245ee11d0fc3f

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