A powerful, Selenium-inspired Python framework for terminal and SSH automation.
Termitty brings the elegance and simplicity of Selenium WebDriver to the world of terminal automation. Just as Selenium revolutionized web browser automation, Termitty transforms how developers interact with command-line interfaces programmatically.
Feature | Termitty | Fabric | Paramiko | Pexpect | Ansible |
---|---|---|---|---|---|
Selenium-like API | β | β | β | β | β |
Terminal Emulation | β Full | β | β | β | |
Session Recording | β | β | β | β | β |
AI-Ready | β | β | β | β | β |
Interactive Shell | β | β | β |
β See detailed comparison for more information
# Familiar patterns for developers who've used Selenium
session = TermittySession()
session.connect('server.com', username='user', key_file='~/.ssh/id_rsa')
session.wait_until(OutputContains('Ready'))
- Full ANSI escape code support
- Virtual terminal with screen buffer management
- Real-time terminal state tracking
- Menu and UI element detection
# Wait for specific conditions
session.wait_until(OutputContains('Task completed'), timeout=30)
session.wait_until(PromptReady('$ '))
session.wait_until(OutputMatches(r'Status: \d+%'))
# Handle interactive applications with ease
with session.interactive_shell() as shell:
shell.send_line('vim config.txt')
shell.wait_for_text('INSERT')
shell.send_keys('Hello World')
shell.send_key(Keys.ESCAPE)
shell.send_line(':wq')
# Record your terminal sessions
session.start_recording('demo.json')
# ... perform actions ...
recording = session.stop_recording()
# Playback later
from termitty.recording import SessionPlayer
player = SessionPlayer('demo.json')
player.play(speed=2.0)
# Execute commands across multiple servers
hosts = ['server1.com', 'server2.com', 'server3.com']
pool = ConnectionPool(hosts, username='user', key_file='~/.ssh/id_rsa')
results = pool.execute_on_all('apt update && apt upgrade -y',
strategy='rolling',
batch_size=2)
# Navigate terminal UIs programmatically
menu_items = session.terminal.find_menu_items()
session.terminal.click_menu_item('Settings')
# Core package (automation, recording, terminal emulation)
pip install termitty
# With UI support (includes beautiful terminal player)
pip install termitty[ui]
Installation Options:
termitty
- Core functionality only (lightweight)termitty[ui]
- Includes rich terminal player with professional UI
Experience terminal recordings like never before:
# Record a session
from termitty import TermittySession
with TermittySession() as session:
session.connect('server.com', username='user', password='pass')
session.start_recording('demo.json')
session.execute('echo "Hello World!"')
session.execute('date')
session.stop_recording()
# Install with UI support and play back with the beautiful player
pip install termitty[ui]
python docs/terminal_player_ui.py demo.json --speed 1.0
Player Features:
- π¨ Professional multi-panel interface
- π Real-time auto-scrolling terminal
- β‘ Variable speeds (0.25Γ to 4Γ)
- π Smart syntax highlighting
- π·οΈ Marker navigation
- β¨οΈ Animated typing effects
from termitty import TermittySession
# Connect to a server
session = TermittySession()
session.connect('example.com', username='user', password='pass')
# Execute commands
result = session.execute('ls -la')
print(result.output)
# Use context managers for directory changes
with session.cd('/var/log'):
logs = session.execute('tail -n 20 syslog')
print(logs.output)
# Handle password prompts
session.execute('sudo apt update')
session.wait_until(OutputContains('[sudo] password'))
session.send_line('password', secure=True)
# Navigate interactive installers
session.execute('./install.sh')
session.wait_until(OutputContains('Do you accept? [y/N]'))
session.send_line('y')
# Access the virtual terminal through session state
terminal = session.state.terminal
# Get screen content
screen_text = terminal.get_screen_text()
print(screen_text)
# Find text on screen
if terminal.find_text('Error'):
print("Error found at:", terminal.cursor_position)
# Take snapshots
snapshot = terminal.snapshot()
For comprehensive documentation, visit our docs folder or check out these guides:
- Getting Started Guide
- API Reference
- Examples
- Architecture
- AI Integration Guide
- Comparison with Alternatives
- Publishing Guide
Termitty is built with a modular architecture:
- Session Layer: High-level API for SSH connections and command execution
- Terminal Emulator: Full VT100/ANSI terminal emulation
- Interactive Shell: Real-time interaction with persistent shell sessions
- Recording System: Capture and replay terminal sessions
- Parallel Executor: Efficient multi-host command execution
See our Architecture Documentation for detailed information.
We welcome contributions! Please see our Contributing Guide for details.
Termitty is licensed under the MIT License. See LICENSE for details.
- Async/await support for all operations
- File transfer capabilities (SCP/SFTP)
- Built-in task templates for common operations
- Terminal session sharing and collaboration
- Web-based session viewer
- Plugin system for custom extensions
- DevOps Automation: Automate server provisioning and configuration
- Testing: Create robust tests for CLI applications
- Monitoring: Build intelligent monitoring scripts that react to terminal output
- Documentation: Record terminal sessions for tutorials and documentation
- Deployment: Orchestrate complex multi-server deployments
- AI Agents: Enable LLMs and coding assistants to control terminals β Learn more
This project is inspired by the elegance of Selenium WebDriver and the need for better terminal automation tools in the DevOps/SRE space.
Ready to automate your terminal workflows? Check out our examples to get started!