pexpect
Pexpect allows easy control of interactive console applications.
Decision gist · record as of 2026-08-14
Yes, if you need to automate interactive console applications on Unix-like systems. Pexpect is stable, widely used (top 1000 on PyPI), has no known vulnerabilities, and carries a permissive license. The aging maintenance status is a minor concern but not a blocker for established use cases; monitor the repository if you depend on active development.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Unix-like system (Linux, macOS, BSD) for full functionality; pty module is not available on Windows, though some features (pattern matching on file descriptors) work there.
- Low install friction with a single pure-Python runtime dependency (ptyprocess).
- Maintenance status is aging—last release was in 2023 and no commits since April 2025—but the package is marked Production/Stable and remains actively used across the ecosystem.
License · maintenance · safety
ISC license (permissive) — Licensed under the ISC License (permissive), which allows commercial and private use with minimal restrictions, making it safe to incorporate into proprietary projects.
last release 2023-11-25 (993 days) · last repo commit 2025-04-11 · 2,847 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 200,755,644 downloads/mo, #206 on PyPI
Alternatives
Verify before relying
pip install pexpect
import pexpect
child = pexpect.spawn('ssh user@host')
child.expect('password:')
child.sendline('mypassword')
child.interact()- Whether the aging maintenance status (last release Nov 2023, no commits since Apr 2025) signals planned maintenance or abandonment.
- Current compatibility with modern Python versions beyond what classifiers indicate.
What it is and what it does
Pexpect is a pure-Python library that lets you spawn child processes (like ssh, ftp, or telnet) and interact with them programmatically as if you were typing at a terminal. You send commands, wait for expected patterns in the output, and respond dynamically—all from Python code. It's modeled after Don Libes' Expect tool but written entirely in Python.
The package is typically used to automate interactive applications, duplicate software installations across servers, run automated tests against interactive tools, or handle any scenario where you need to script interaction with a program that expects human input. Its main dependency is ptyprocess, a lightweight wrapper around Unix pseudo-terminals. Most features require a Unix-like system (Linux, macOS, BSD); Windows support is partial.
Use it for
- Automate SSH logins and remote command execution with password or key-based authentication.
- Script FTP or SFTP file transfers that require interactive authentication.
- Run automated testing against interactive CLI tools or setup wizards.
- Duplicate software package installations across multiple servers by automating interactive setup prompts.
- Control telnet or other legacy interactive protocols from Python without manual intervention.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to automate interactive console applications on Unix-like systems.
Pexpect is stable, widely used (top 1000 on PyPI), has no known vulnerabilities, and carries a permissive license. The aging maintenance status is a minor concern but not a blocker for established use cases; monitor the repository if you depend on active development.
Install
pexpect on PyPI
Before you install
Low install friction with a single pure-Python runtime dependency (ptyprocess). Maintenance status is aging—last release was in 2023 and no commits since April 2025—but the package is marked Production/Stable and remains actively used across the ecosystem.
Requires Unix-like system (Linux, macOS, BSD) for full functionality; pty module is not available on Windows, though some features (pattern matching on file descriptors) work there.
License in practice
Licensed under the ISC License (permissive), which allows commercial and private use with minimal restrictions, making it safe to incorporate into proprietary projects.
Quickstart
pip install pexpect
import pexpect
child = pexpect.spawn('ssh user@host')
child.expect('password:')
child.sendline('mypassword')
child.interact()
Verify before relying
- Whether the aging maintenance status (last release Nov 2023, no commits since Apr 2025) signals planned maintenance or abandonment.
- Current compatibility with modern Python versions beyond what classifiers indicate.
Package facts
| License | ISC license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageptyprocess |
| Maintenance | Aging 993 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 200,755,644 / month, #206 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: ISC License (ISCL)Operating System :: MacOS :: MacOS XOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: SystemTopic :: System :: Archiving :: PackagingTopic :: System :: Installation/SetupTopic :: System :: ShellsTopic :: System :: Software DistributionTopic :: Terminals |
Evidence: pexpect-4.9.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “automate interactive terminal applications”
- pexpectPexpect spawns and controls interactive console applications by…
- ptyprocessRun a subprocess in a pseudo terminal (pty) and interact with its…
- curtsiesCurtsies provides a Python library for building interactive terminal…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also delegator.py · paramiko-expect · pexpect-serial · ptyprocess · pywinpty · types-pexpect · pairmux · mozprocess · dockerpty · tendo