https://github.com/amoffat/sh
Python process launching
https://github.com/amoffat/sh
devops python subprocess
Last synced: 3 months ago
JSON representation
Python process launching
- Host: GitHub
- URL: https://github.com/amoffat/sh
- Owner: amoffat
- License: mit
- Created: 2012-01-15T05:52:06.000Z (almost 14 years ago)
- Default Branch: develop
- Last Pushed: 2025-04-29T19:02:53.000Z (7 months ago)
- Last Synced: 2025-05-05T17:21:08.277Z (7 months ago)
- Topics: devops, python, subprocess
- Language: Python
- Homepage: https://sh.readthedocs.io/en/latest/
- Size: 2.2 MB
- Stars: 7,078
- Watchers: 132
- Forks: 504
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- fucking_awesome_python - sh - A full-fledged subprocess replacement for Python. (Processes)
- fucking-awesome-python-cn - sh
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-github-repos - amoffat/sh - Python process launching (Python)
- awesome-list - sh - A full-fledged subprocess replacement for Python 2, Python 3, PyPy and PyPy3 that allows you to call any program as if it were a function. (Process, Thread & Coroutine / C++/C Toolkit)
- awesome-python-zh - sh - 一个完整的Python子进程替代品。 (流程)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python-again -
- awesome-python-resources - GitHub - 2% open · ⏱️ 18.08.2022): (进程)
- python-awesome - sh - A full-fledged subprocess replacement for Python. (Processes)
- my-awesome-starred - sh - Python process launching (Python)
- starred-awesome - sh - Python process launching (Python)
- best-of-python - GitHub - 2% open · ⏱️ 01.11.2025): (Process Utilities)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python - sh - Python process launching ` 📝 18 days ago ` (Processes [🔝](#readme))
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- fucking-awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- fucking-awesome-python - :octocat: sh - :star: 6656 :fork_and_knife: 499 - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python-cn - sh
- Awesome-Python - sh - A full-fledged subprocess replacement for Python. (Processes)
- Python-Awesome - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python - sh - Python process launching (Awesome Python / Processes)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-hacking-lists - amoffat/sh - Python process launching (Python)
- git-github.com-vinta-awesome-python - sh - A full-fledged subprocess replacement for Python. (Processes)
- awesome-repositories - amoffat/sh - Python process launching (Python)
README
.. image:: https://raw.githubusercontent.com/amoffat/sh/master/images/logo-230.png
:target: https://amoffat.github.com/sh
:alt: Logo
**If you are migrating from 1.* to 2.*, please see MIGRATION.md**
|
.. image:: https://img.shields.io/pypi/v/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Version
.. image:: https://img.shields.io/pypi/dm/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Downloads Status
.. image:: https://img.shields.io/pypi/pyversions/sh.svg?style=flat-square
:target: https://pypi.python.org/pypi/sh
:alt: Python Versions
.. image:: https://img.shields.io/coveralls/amoffat/sh.svg?style=flat-square
:target: https://coveralls.io/r/amoffat/sh?branch=master
:alt: Coverage Status
|
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:
.. code:: python
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 `_
`Full documentation on a single page for LLM-assisted coding here `_
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.