paramiko-expect
An expect-like extension for the Paramiko SSH library
What it is and what it does
Paramiko Expect wraps the Paramiko SSH library to provide an expect-like interface for scripting interactive terminal sessions. Instead of managing raw SSH channels, you construct an SSHClientInteraction object from an existing Paramiko SSH client, then send commands and wait for patterns (prompts, strings, or regex) to appear in the output. The class handles timeouts, captures both raw and cleaned output, and lets you match multiple patterns and branch on which one was found—similar to the Unix expect tool but over SSH.
The package is designed for automating interactive CLI tools, log tailing, and multi-step remote procedures where you need to respond to prompts or wait for specific output before proceeding. It includes a tail() method for streaming output from long-running commands. The single runtime dependency is paramiko, and it installs as a pure Python wheel with low friction. However, the project is archived and abandoned as of late 2022, with no active maintenance or updates.
Use it for:
- Automating interactive CLI tools on remote servers (e.g., database prompts, configuration wizards) via SSH.
- Scripting multi-step remote procedures that require waiting for prompts and sending responses in sequence.
- Tailing and monitoring log files on multiple remote hosts in real time.
- Testing interactive SSH-based applications or command-line interfaces programmatically.
- Building deployment or system administration scripts that interact with remote interactive shells.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Paramiko Expect adds expect-like pattern matching and interaction to Paramiko SSH connections, letting you script interactive terminal sessions over SSH with command sending, output capture, and prompt-based flow control.
Yes, but with caution. The package is straightforward and has no known vulnerabilities, and low install friction makes it easy to try. However, it is abandoned—the repository is archived and the last release was in 2022. Use it for one-off scripts or internal automation where you control the environment, but avoid it for production systems or long-term maintenance unless you are prepared to fork and maintain it yourself. For new projects requiring robust SSH automation, consider whether a maintained alternative better suits your needs.
Install
paramiko-expect on PyPI
pip
pip install paramiko-expectuv
uv add paramiko-expectpoetry
poetry add paramiko-expectInstalling paramiko-expect
Before you install
Low install friction; depends only on paramiko. However, the package is abandoned (last release 2022-11-19, repository archived), so no active maintenance or security updates are forthcoming.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or distribution in your own projects.
Quickstart
pip install paramiko-expect
from paramiko_expect import SSHClientInteraction
import paramiko
client = paramiko.SSHClient()
client.connect(hostname='example.com', username='user', password='pass')
interact = SSHClientInteraction(client, timeout=10)
interact.expect('$')
interact.send('ls -l')
interact.expect('$')
output = interact.current_output_clean
Verify before relying
- Whether the package works reliably with modern Paramiko versions and current Python releases beyond 3.9.
- Whether the abandoned status and lack of recent maintenance poses compatibility risks with newer SSH server configurations.
- Real-world stability and edge-case handling in production environments given no active development.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — paramiko |
| Maintenance | abandoned — 1,364 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 584,282/month — #5,889 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: paramiko_expect-0.3.5-py2.py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
spurProvides a unified Python interface to run…
permissive · top 15,000 on PyPI
jumpsshJumpSSH runs commands on remote servers through…
permissive · top 15,000 on PyPI
sshtunnelEstablishes SSH tunnels to forward local ports…
permissive · top 1,000 on PyPI
mock-ssh-serverProvides a Python context manager that runs an…
permissive · top 15,000 on PyPI
paramikoParamiko is a pure-Python SSH protocol library…
copyleft · top 1,000 on PyPI
fabricFabric executes shell commands remotely over…
permissive · top 5,000 on PyPI
fabric2Fabric executes shell commands remotely over…
permissive · top 15,000 on PyPI
netconf-console2A command-line and interactive console tool for…
permissive · top 15,000 on PyPI
iterm2Provides a Python scripting interface to…
copyleft · top 15,000 on PyPI