Skip to main content

subprocess-tee

Project description

subprocess-tee

This package provides an drop-in alternative to subprocess.run that captures the output while still printing it in real time, just the way tee does.

Printing output in real-time while still capturing is important for any tool that executes long running child processes, as you may not want to deprive user from getting instant feedback related to what is happening.

# from subprocess import run
from subprocess_tee import run

result = run("echo 123")
result.stdout == "123\n"

Rich extension

This libary also provides an drop-in replacement for rich Console class, one that is able to rewire both sys.stdout and sys.stderr and avoid the need too replace bare print() calls with console.print() ones.

# from rich.console import Console
from subprocess_tee.rich import ConsoleEx

console = ConsoleEx(redirect=True, record=True)
print("123")
assert "123\n" == console.export_text()

When used in conjuction with our own run(), this also makes it possible to use rich to process output produced by subprocesses.

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

subprocess-tee-0.1.6.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

subprocess_tee-0.1.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file subprocess-tee-0.1.6.tar.gz.

File metadata

  • Download URL: subprocess-tee-0.1.6.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for subprocess-tee-0.1.6.tar.gz
Algorithm Hash digest
SHA256 45f13c066d04df41d9fcf48148e64f02f233c332f35ee312576cd0a9818eb2fe
MD5 440d25382879c21f590ea0e408b71e2a
BLAKE2b-256 9fbfaa3119f7f00b1bf2e34e45dcc2163de00a5f3c810a6597b62f9d8ecb9541

See more details on using hashes here.

File details

Details for the file subprocess_tee-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: subprocess_tee-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for subprocess_tee-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7fce49e85a7f1e3efa8cf19f381c67ba5bfbc96d8e0ef21fe4f9d9ec901d7d0b
MD5 ae7dfc990c20cb5defc1eb5017b938e5
BLAKE2b-256 702e23320a202513b6e52209a978d9845604fc254f82a10220cdcc8523456005

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