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
File details
Details for the file simple_pipes-0.3.1.tar.gz
.
File metadata
- Download URL: simple_pipes-0.3.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5601b7f66a677cc18cd041a6944935019561d1b94048ea6be34a2a873553913 |
|
MD5 | caecac68a19d51a71602d2576f9220ae |
|
BLAKE2b-256 | 3f6c65665841c82ad0969454221f7f157b6922cb20cf00c24abada9deb96d9c3 |
File details
Details for the file simple_pipes-0.3.1-py2-none-any.whl
.
File metadata
- Download URL: simple_pipes-0.3.1-py2-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 305f2092a9b15759dee723dceee134be9df9004c00e03312f62f9985b8916f0e |
|
MD5 | 6f683b325532e890acc54a737e8b55e8 |
|
BLAKE2b-256 | 3e94eca7181a1848c203c78d18ce28abb7631185bbbef81bbcfe14694eb9e4bd |