shellio
ShellIO is a Python interface for interacting with Unix-like shells (sh, bash, zsh) using pseudoterminals (PTY). It enables real-time communication with interactive shell processes, capturing and parsing output including ANSI escape sequences.
Features
- ✅ Spawn interactive shell sessions (sh, bash, zsh)
- 📤 Send input directly to the shell (stdin)
- 📥 Read output instantly using PTY — no line buffering delay
- 🧩 Detect and split ANSI escape sequences from raw output
- 🧼 Automatically terminates all shell processes on exit
- 🧵 Background threading for non-blocking output reading
- 🔀 Supports multiple concurrent shell instances
Use Cases
- Terminal emulators
- Shell automation tools
- Output parsers
- Teaching/debugging shell interactions
Instalation
$ pip install shellio
Example of usage:
from shellio import ShellIO
# Initialize a new shell object
shell = ShellIO('bash', []) # zsh, sh or bash
# You can specify a path where to start the shell
shell.set_cwd('.')
# Start the process
shell.run()
# Clear last output file
open('output.txt', 'w').close()
# Put the first command with a return
shell.put('ls -la\n')
# Wait a second for output
shell.wait(2)
# Put the second command
shell.put('touch works.txt\n')
# Read all bytes from shell and save it to a file
for b in shell.get(timeout=0.01):
print(b.decode(), end='')
with open('output.txt', 'a') as file:
file.write(b.decode())
Metadata
Release files for shellio 1.0.1
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 |
|---|---|---|---|---|
| shellio-1.0.1.tar.gz | 4.6 kB | Without provenance | Details for shellio-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shellio-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for shellio-1.0.1-py3-none-any.whl |
Total release size: 9.5 kB
Release files / shellio-1.0.1.tar.gz
| Download URL | shellio-1.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67a6abae0cfb9ed3d9896df82510f3276e3c4cdb32f67f63072155f39cea1a46
|
|
BLAKE2b-256 checksum How to use checksums |
0bfc4631dbf863b8288d1a43f1cc25984ab179b5c58c2bc2aa5f99112ca7d189
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / shellio-1.0.1-py3-none-any.whl
| Download URL | shellio-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3e3b017865418728b44f76d1737c960d0142407491c81fcee2bda53916b57b1
|
|
BLAKE2b-256 checksum How to use checksums |
781358078d2c5d4d06c00617b05047038a4dd5c0525bdc041f2878e677fa86b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for shellio 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.