This release is a pre-release and may not be stable for production use.
shell-use (Python)
Python bindings for shell-use; a terminal automation, inspection, assertion, and recording engine written in Rust.
Install
pip install shell-use
Requires Python 3.8+. Wheels are published for common platforms via maturin
Quick start
import asyncio
from shell_use import ShellUse
async def main():
async with ShellUse() as su:
await su.open()
await su.submit("echo hello")
await su.wait_command()
await su.expect_text("hello")
await su.expect_exit_code(0)
asyncio.run(main())
Drive a full-screen TUI:
async with ShellUse("vim-session") as su:
await su.run("vim", "file.txt")
await su.wait_idle()
await su.press("i")
await su.type("some text")
await su.press("Escape", ":", "w", "q", "Enter")
await su.wait_exit()
Errors
Every failure maps to one of the engine's error kinds:
| Exception | Exit code | Meaning |
|---|---|---|
ExpectationError |
1 | an expect/wait condition was not met |
UsageError |
2 | invalid argument (e.g. a bad regex) |
NoSessionError |
3 | no active session |
InternalError |
5 | internal engine error |
All derive from ShellUseError. wait_* and expect_* raise ExpectationError on failure. Assertion errors include the current visible terminal content.
API
ShellUse(session="default", *, timeouts=None, artifacts=None) mirrors the cli: open / run, type / write, submit, press / keys, mouse.click|move|down|up|drag|scroll, resize, signal / kill, state, text, cells, get_command / get_output / get_exit_code / get_cwd / get_cursor / get_size, screenshot, wait_text / wait_idle / wait_command / wait_exit / wait_ready, expect_text / expect_exit_code / expect_output / expect_snapshot, close, and close_quiet.
Module-level helpers: sessions(), close_all(), get_recording(), unique_session().
open() and run() accept wait_ready=, retries=, and timeouts=. The timeout classes are text, idle, command, exit, and ready; timeouts= sets session defaults, the constructor takes the same Timeouts (or a dict) as a client-wide default. Unknown class names raise.
ShellUse.ephemeral(prefix=None, **kwargs) binds a client to a unique,
process-local session name. artifacts={"dir": ..., "on_failure": ...}
attaches the terminal contents to an ExpectationError.
shell_use.testing has helpers for terminal tests: create_terminal, terminal (an async context manager), close_all_tracked, DEFAULT_SHELL, and terminal_snapshot.
from shell_use.testing import terminal
async def test_echo():
async with terminal() as t:
await t.submit("echo hi")
await t.wait_command()
await t.expect_text("hi")
Each terminal is uniquely named, so parallel workers don't collide. set_terminal_defaults(...) sets suite-wide options (timeouts, artifacts, ...).
Cancellation and recordings
Cancelling a task does not cancel the underlying Rust operation. Operations for single sessoins wait for completion (ex: close(), close_all()).
Closing a session removes it from sessions(), but keeps its recording. get_recording() can read that recording for the rest of the process. The 1024 most recently closed sessions have their recordings retained.
Configuration
| Variable | Purpose |
|---|---|
SHELL_USE_SESSION |
default session name |
SHELL_USE_TIMEOUT_<CLASS>_MS |
fallback timeout for one class (TEXT, IDLE, COMMAND, EXIT, READY) |
Metadata
Release files for shell-use 0.0.1b6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shell_use-0.0.1b6.tar.gz | 1.7 MB | With provenance | Details for shell_use-0.0.1b6.tar.gz |
Built distributions (wheels)
Total release size: 28.0 MB
Release files / shell_use-0.0.1b6.tar.gz
| Download URL | shell_use-0.0.1b6.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e89c122f2281931bbae0963ab14892745f5a2afd30d957d8bfb3af61719f952
|
|
BLAKE2b-256 checksum How to use checksums |
42ace26ddfb39eec11d7132667c125c9b18cbdd308f347c970d9ebebb6dd36d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-win_arm64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8ae62b450f8ac32bcbc670a2b1f74350aa09dd6ecebc81dd1f735f5125f48feb
|
|
BLAKE2b-256 checksum How to use checksums |
adf691ffec64137e134923fd020f92adf2909f216803b3a3de630af78464871f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-win_amd64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3e907a2fe1428a029db67fb3a778b5771a4969ddb82261e01a7b5f21caf8b01e
|
|
BLAKE2b-256 checksum How to use checksums |
2eed9b3f5809a83ef968c0462935a01c6d11760456feed3471db62c682f6055b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 3.5 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d2f82f29b4d3d8f15b35ee4640c08e278e2c9fa2617fbc05ca9e2b81ad48902c
|
|
BLAKE2b-256 checksum How to use checksums |
8552bdf3eec077406a443726fe30c13cfd0f53421405e7728c0d99020b577299
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
f004a30efea956d76f7b977fa0d5d3c33eecc90eccc09ba1a04f81dd9dfd5550
|
|
BLAKE2b-256 checksum How to use checksums |
2f229b29f39362fdbd78453370bbae5e29545b02b3bae8995b045dcc29040062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-manylinux_2_28_x86_64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
786608c26c4f59e4c9ed0f8c041961c3112ab283a9fa1dd808b071a11e9bab3b
|
|
BLAKE2b-256 checksum How to use checksums |
fd45aa363c0ab35152e02e09e8612687d260a081dcc5dd6aac2a9b579a629f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-manylinux_2_28_aarch64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c2e4f2259be97f8fc45a2216918a04d86b7870696cb0048794697c394d4e7e68
|
|
BLAKE2b-256 checksum How to use checksums |
8934fd39751185884fd25d3882ecb0403379e4f5ecdd19835ddac87766b1116e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e03da8c17d8f699674a456d745d2c501ce953d2f134441364924fcba7bea8b7a
|
|
BLAKE2b-256 checksum How to use checksums |
6ac276a8958948ef9c505ec70400510f70d125250b0d78e2b90cfdb2e10fd61e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logRelease files / shell_use-0.0.1b6-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | shell_use-0.0.1b6-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
875145575a38889f2d338dc06f119a64f527794e262869e7ec1482ac690368e6
|
|
BLAKE2b-256 checksum How to use checksums |
1ebe68203c1f55442d5a4362fd85c47a1305834213ac5f9bffc2971b8c8a0857
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logSecurity for shell-use 0.0.1b6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for shell_use-0.0.1b6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.