添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

Complete documentation 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

    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 "PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation .
    © 2024 Python Software Foundation
    Site map