Skip to main content

teesh

tee for python subprocess

version license

teesh is a streamlined, modern interpretation of subprocess.run(), with an API inspired by the needs of human-focused automation and scripts.

When running a subprocess with teesh, stdout and stderr will always be captured, but stdout and stderr will also always go to the console, allowing both the user and the program to see and introspect the output:

>>> import teesh
>>> result = teesh.run("/bin/echo", "hello world")
hello world
>>> # ^ this message was sent to stdout
>>> # v it was also captured in the result
>>> result
CompletedProcess(cmd=('/bin/echo', 'hello world'), returncode=0, stdout='hello world\n', stderr='')

teesh checks for non-zero return codes by default:

>>> teesh.run("/usr/bin/false")
Traceback (most recent call last):
  ...
teesh.core.CalledProcessError: Command '/usr/bin/false' returned non-zero exit status 1.

teesh always uses unicode strings instead of bytes:

>>> type(teesh.run("/bin/echo", "hello world").stdout)
hello world
<class 'str'>

teesh happily accepts mixed Path objects:

>>> filename = Path("README.md")
>>> teesh.run("head", "-n1", filename)
# teesh
CompletedProcess(cmd=('head', '-n1', 'README.md'), returncode=0, stdout='# teesh\n', stderr='')

teesh is composable:

>>> from functools import partial
>>> sudo = partial(teesh.run, "sudo")
>>> sudo("whoami")
root
CompletedProcess(cmd=('sudo', 'whoami'), returncode=0, stdout='root\n', stderr='')

License

teesh is and always will be 100% human generated.

teesh is copyright Amethyst Reese, and licensed under the MIT license.

Metadata

Release files for teesh 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teesh 1.0
File Size Uploaded
teesh-1.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for teesh 1.0
File Interpreter ABI Platform
teesh-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / teesh-1.0.tar.gz

Download URL teesh-1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
26eec378f7b9ee7b5ebda6914f102eb529eec32d2c1afad53e9a85cf296497d1
BLAKE2b-256 checksum
How to use checksums
94e83a8492ac0290687fc303c566120a513e462318eb517f0d0601b6bce8f022
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / teesh-1.0-py3-none-any.whl

Download URL teesh-1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ade6b02b2fd65aa5c97751f3fc67a3e12eedc3187de0959408acbeb1a09a74d4
BLAKE2b-256 checksum
How to use checksums
b42434f7dc0485d13877fbc11beeb56ee5174b4ce1d0eb303ddf541a73a05d58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page