Skip to main content

Subprocess utils

Project description

Pipes

Subprocess utils

Status

Source Shields
Project license release
Publishers pypi
Downloads pypi_downloads
Raised issues pulls

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_pipes-0.3.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

simple_pipes-0.3.1-py2-none-any.whl (4.2 kB view details)

Uploaded Python 2

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

Hashes for simple_pipes-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d5601b7f66a677cc18cd041a6944935019561d1b94048ea6be34a2a873553913
MD5 caecac68a19d51a71602d2576f9220ae
BLAKE2b-256 3f6c65665841c82ad0969454221f7f157b6922cb20cf00c24abada9deb96d9c3

See more details on using hashes here.

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

Hashes for simple_pipes-0.3.1-py2-none-any.whl
Algorithm Hash digest
SHA256 305f2092a9b15759dee723dceee134be9df9004c00e03312f62f9985b8916f0e
MD5 6f683b325532e890acc54a737e8b55e8
BLAKE2b-256 3e94eca7181a1848c203c78d18ce28abb7631185bbbef81bbcfe14694eb9e4bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page