Skip to main content

Allows to execute subprocess commands and get their output in real-time.

Project description

B.ContinuousSubprocess

A helper package that lets you execute long running processes and continuously receive their output.

Description

Imagine you want to programmatically run a command that lists objects in a given directory. The command subprocess.call('ls') will do the trick quite conveniently. However, the same approach to long running commands like cdk deploy * or pytest -s or ls / -R is not very convenient as you get the whole output only when the process finishes. This package solves this inconvenience by outputting data in real-time as the process runs.

Remarks

Biomapas aims to modernise life-science industry by sharing its IT knowledge with other companies and the community. This is an open source library intended to be used by anyone. Improvements and pull requests are welcome.

Related technology

  • Python 3
  • Python subprocess Popen
  • OS processes

Assumptions

The project assumes the following:

  • You have basic knowledge in python programming.
  • You have basic knowledge in OS processes.

Useful sources

Install

The project is built and uploaded to PyPi. Install it by using pip.

pip install b-continuous-subprocess

Or directly install it through source.

pip install .

Usage & Examples

The library is extremely easy to use. Simply create an instance of ContinuousSubprocess and execute it to get a generator. Then iterate through the generator to receive your process output in real time.

from b_continuous_subprocess.continuous_subprocess import ContinuousSubprocess

command = str('cdk deploy *')
generator = ContinuousSubprocess(command).execute()

for data in generator:
    print(data)

Testing

The project has tests that can be run. These are mostly simple tests that can be run out-of-the-box.

Run tests from a root directory with pytest python testing library:

pytest

The tests usually take less than a few seconds to complete.

Contribution

Found a bug? Want to add or suggest a new feature?
Contributions of any kind are gladly welcome. You may contact us directly, create a pull-request or an issue in github platform. Lets modernize the world together.

Release history

0.1.1

  • Pipe errors too.

0.1.0

  • Add ability to kill a process.

0.0.3

  • Start using Pylint.
  • Start using Black.

0.0.2

  • Finalize pipelines.
  • Finalize project structure and naming.

0.0.1

  • Initial build.

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

b_continuous_subprocess-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

b_continuous_subprocess-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file b_continuous_subprocess-0.1.1.tar.gz.

File metadata

  • Download URL: b_continuous_subprocess-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for b_continuous_subprocess-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bfb27e48d9d4a34b950913dd5eac67180cb0c640de74e0e450770053a5bf19d3
MD5 816ad9eb9b30721417250b7536f204c8
BLAKE2b-256 0b056d4820cf98786e13ef67a3158240f26d66039ff239a64d8cd5c4c0c4963a

See more details on using hashes here.

File details

Details for the file b_continuous_subprocess-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: b_continuous_subprocess-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for b_continuous_subprocess-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8927da1d4c8e6743f3b6004d6f89ec53fd6b0627e93764b40f5faaabc78e440e
MD5 5297b18d5f1d95269f84ead511668df9
BLAKE2b-256 f95f6460e2f630658cd8da028d865e69719506f6da52a579ef4137aa54843439

See more details on using hashes here.

Supported by

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