Skip to content

Live-Streaming Tool Output

For synchronous runs for Python and Lug, Toolchest supports streaming remote output live to wherever you're running Toolchest.

For example, here's a python3 Toolchest call with streaming enabled and an example script:

import toolchest_client as tc
tc.set_key("YOUR_KEY")
tc.python3(
    script="script.py",
    streaming_enabled=True,
)

# script.py
import time
for letter in ["A", "B", "C"]:
    print(f"Hello world {letter}")
    time.sleep(1)

You'll see the following lines printed as they are generated by the remotely-running Python script, one line per second:

Hello world A
Hello world B
Hello world C

Streaming and cancelling runs

With streaming enabled, tool execution terminates if the streaming connection is broken. This includes cancelling your job by entering Ctrl-C.

If a job is cancelled before encountering a bug in your script, the error may not be visible in Toolchest logs.

Supported Tools

Output streaming is supported for python3 and lug. For both, streaming is enabled by default.