Python subprocess replacement
Project description
If you are migrating from 1.* to 2.*, please see MIGRATION.md
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.
Installation
$> pip install sh
Support
Andrew Moffat - author/maintainer
Erik Cederstrand - maintainer
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e27301c574bec8ca5bf6f211851357526455ee97cd27a7c4c6cc5e2375399cb |
|
MD5 | eba6bd8ec843a707bdc481577835980d |
|
BLAKE2b-256 | 5212b7965006c5adc57ba5459385358bd27c4983cd490884a75be86eb1d3efeb |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf5e44178dd96a542126c2774e9b7ab1d89bfe0e2ef84d92e6d0ed7358d63d01 |
|
MD5 | 626a32ccbd12ccb40c1ea2fa7b1f2806 |
|
BLAKE2b-256 | 0059f6551f49c123751e921038c24215157bd50aef375ced16cac57229678c43 |