.. 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.11, 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 <https://sh.readthedocs.io/>_
::
$> pip install sh
Andrew Moffat <https://github.com/amoffat>_ - author/maintainerErik Cederstrand <https://github.com/ecederstrand>_ - maintainerTests 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
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.


职场AI,就用扣子
AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!


多风格AI绘画神器
堆友平台由阿里巴巴设计团 队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。

