sh (original) (raw)
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.12, 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
Docs
To build the docs, make sure you’ve run poetry install to install the dev dependencies, then:
$> cd docs $> make html
This will generate the docs in docs/build/html. You can open the index.html file in your browser to view the docs.
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.
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.2.2.tar.gz
.
File metadata
- Download URL: sh-2.2.2.tar.gz
- Upload date: Feb 24, 2025
- Size: 345.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Hashes for sh-2.2.2.tar.gz | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | 653227a7c41a284ec5302173fbc044ee817c7bad5e6e4d8d55741b9aeb9eb65b | | | MD5 | 961d38de16f88556bd70381eddd7f415 | | | BLAKE2b-256 | 5952f43920223c93e31874677c681b8603d36a40d3d8502d3a37f80d3995d43e | |
See more details on using hashes here.
Provenance
The following attestation bundles were made for sh-2.2.2.tar.gz
:
Publisher: main.yml on amoffat/sh
Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
- Statement:
- Statement type: https://in-toto.io/Statement/v1
- Predicate type: https://docs.pypi.org/attestations/publish/v1
- Subject name:
sh-2.2.2.tar.gz
- Subject digest:
653227a7c41a284ec5302173fbc044ee817c7bad5e6e4d8d55741b9aeb9eb65b
- Sigstore transparency entry: 173689634
- Sigstore integration time: Feb 24, 2025
Source repository: - Permalink: amoffat/sh@a834c0d273a1b3281c14918a4a27b2fdb0034627
- Branch / Tag: refs/heads/master
- Owner: https://github.com/amoffat
- Access:
public
Publication detail: - Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow: main.yml@a834c0d273a1b3281c14918a4a27b2fdb0034627
- Trigger Event:
push
File details
Details for the file sh-2.2.2-py3-none-any.whl
.
File metadata
- Download URL: sh-2.2.2-py3-none-any.whl
- Upload date: Feb 24, 2025
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Hashes for sh-2.2.2-py3-none-any.whl | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | e0b15b4ae8ffcd399bc8ffddcbd770a43c7a70a24b16773fbb34c001ad5d52af | | | MD5 | b2203490fa37576fb4b0bb4610333e38 | | | BLAKE2b-256 | 7098d82f14ac7ffedbd38dfa2383f142b26d18d23ca6cf35a40f4af60df666bd | |
See more details on using hashes here.
Provenance
The following attestation bundles were made for sh-2.2.2-py3-none-any.whl
:
Publisher: main.yml on amoffat/sh
Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
- Statement:
- Statement type: https://in-toto.io/Statement/v1
- Predicate type: https://docs.pypi.org/attestations/publish/v1
- Subject name:
sh-2.2.2-py3-none-any.whl
- Subject digest:
e0b15b4ae8ffcd399bc8ffddcbd770a43c7a70a24b16773fbb34c001ad5d52af
- Sigstore transparency entry: 173689636
- Sigstore integration time: Feb 24, 2025
Source repository: - Permalink: amoffat/sh@a834c0d273a1b3281c14918a4a27b2fdb0034627
- Branch / Tag: refs/heads/master
- Owner: https://github.com/amoffat
- Access:
public
Publication detail: - Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow: main.yml@a834c0d273a1b3281c14918a4a27b2fdb0034627
- Trigger Event:
push