Subprocess utils
Project description
Pipes
Subprocess utils
Status
Source | Shields |
---|---|
Project | |
Publishers | |
Downloads | |
Raised |
Installing
To install the package from pypi:
pip install simple_pipes
Alternatively, you can clone the repo and build the package locally.
Usage
Pass a command in exec form:
from simple_pipes import pipe_call, pipe_capture
pipe_call(["echo", "Hello"])
This is equivalent to:
import subprocess
subprocess.Popen(["echo", "Hello"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Changing directory before execxution:
pipe_call(["echo", "Hello"], cwd=".")
If you're running a command does not terminate, such as starting a server, the program will remain attached.
To detach the running process on a given string output:
wrapper = pipe_call(["echo", "Hello"], break_str="Hello"):
You must keep the wrapper object in scope or the detached process will be terminated in garbage collection.
Often you want to run a process until it terminates and capture the entire output:
output = pipe_capture(["echo", "Hello"], cwd=".")
print(output)
>> Hello
Docs
Additional details are available in the full documentation.
To generate the documentation locally:
multi-job docs
Tests
Unit tests and behaviour tests are written with the pytest framework.
To run tests:
multi-job tests
Additionally, an html report will be saved to the local directory.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
Versioning
SemVer is used for versioning. For a list of versions available, see the tags on this repository.
Bump2version is used to version and tag changes. For example:
bump2version patch
Releases are made on every major change.
Author
- Joel Lefkowitz - Initial work - Joel Lefkowitz
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
None yet!
Project details
Release history Release notifications | RSS feed
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
Hashes for simple_pipes-0.3.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 305f2092a9b15759dee723dceee134be9df9004c00e03312f62f9985b8916f0e |
|
MD5 | 6f683b325532e890acc54a737e8b55e8 |
|
BLAKE2b-256 | 3e94eca7181a1848c203c78d18ce28abb7631185bbbef81bbcfe14694eb9e4bd |