Python process launching

Overview
Logo

Version Downloads Status Python Versions Build Status Coverage Status

sh is a full-fledged subprocess replacement for Python 2.6 - 3.8, PyPy and PyPy3 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.

Complete documentation here

Installation

$> pip install sh

Support

Developers

Updating the docs

Check out the gh-pages branch and follow the README.rst there.

Testing

I've included a Docker test suite in the docker_test_suit/ folder. To build the image, cd into that directory and run:

$> ./build.sh

This will install ubuntu 18.04 LTS and all python versions from 2.6-3.8. Once it's done, stay in that directory and run:

$> ./run.sh

This will mount your local code directory into the container and start the test suite, which will take a long time to run. If you wish to run a single test, you may pass that test to ./run.sh:

$> ./run.sh FunctionalTests.test_unicode_arg

To run a single test for a single environment:

$> ./run.sh -e 3.4 FunctionalTests.test_unicode_arg

Coverage

First run all of the tests:

$> python sh.py test

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.

Owner
Andrew Moffat
Tech Generalist
Andrew Moffat
A Python module for controlling interactive programs in a pseudo-terminal

Pexpect is a Pure Python Expect-like module Pexpect makes Python a better tool for controlling other applications. Pexpect is a pure Python module for

2.3k Dec 26, 2022
Python process launching

sh is a full-fledged subprocess replacement for Python 2.6 - 3.8, PyPy and PyPy3 that allows you to call any program as if it were a function: from sh

Andrew Moffat 6.5k Jan 04, 2023
Run a subprocess in a pseudo terminal

Launch a subprocess in a pseudo terminal (pty), and interact with both the process and its pty. Sometimes, piping stdin and stdout is not enough. Ther

184 Jan 03, 2023
Jurigged lets you update your code while it runs.

jurigged Jurigged lets you update your code while it runs. Using it is trivial: python -m jurigged your_script.py Change some function or method with

Olivier Breuleux 767 Dec 28, 2022
Supervisor process control system for UNIX

Supervisor Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems. Supported Platf

Supervisor 7.6k Jan 02, 2023