pexpect
Pexpect allows easy control of interactive console applications.
Install
pexpect on PyPI
pip
pip install pexpectuv
uv add pexpectpoetry
poetry add pexpectPackage facts
| License | ISC license (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — ptyprocess |
| Maintenance | aging — 992 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: pexpect-4.9.0-py2.py3-none-any.whl
About pexpect
from the package's own PyPI description — quoted content, verbatim
Pexpect is a pure Python module for spawning child applications; controlling them; and responding to expected patterns in their output. Pexpect works like Don Libes' Expect. Pexpect allows your script to spawn a child application and control it as if a human were typing commands.
Pexpect can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to automate setup scripts for duplicating software package installations on different servers. It can be used for automated software testing. Pexpect is in the spirit of Don Libes' Expect, but Pexpect is pure Python.
The main features of Pexpect require the pty module in the Python standard library, which is only available on Unix-like systems. Some features—waiting for patterns from file descriptors or subprocesses—are also available on Windows.
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Pexpect spawns and controls child applications interactively, automating responses to expected output patterns. It enables scripting of interactive programs like ssh, ftp, and telnet as if a human were typing commands.
Low friction: pure Python wheel with a single runtime dependency (ptyprocess). Maintenance is aging—last release was 992 days ago—but the repository remains active with recent commits and 2847 stars, suggesting stable, established code.
ISC license is permissive and imposes minimal restrictions; you may use, modify, and distribute pexpect with few obligations beyond retaining the license notice.
Usage
pip install pexpect
import pexpect
child = pexpect.spawn('ssh user@host')
child.expect('password:')
child.sendline('mypassword')
Requires Unix-like system (Linux, macOS, BSD) for full functionality; pty module is not available on Windows, though some features work there.
Verdict: Pexpect is a stable, well-established library for automating interactive terminal applications. Its permissive ISC license, low install friction, and zero known vulnerabilities make it safe to adopt. The aging maintenance status (992 days since last release) reflects maturity rather than abandonment—the codebase is production-stable and actively maintained. Best suited for Unix-like systems; Windows support is partial.
Needs verification
- Whether the package's Python 2.7 classifier reflects actual support or is outdated documentation
- Current test coverage and whether the aging release cycle indicates sufficient maintenance for new Python versions
Similar packages
permissive · top 1,000 on PyPI
PyYAMLpermissive · top 100 on PyPI
pre-commitpermissive · top 1,000 on PyPI
linkify-it-pypermissive · top 1,000 on PyPI
universal-pathlibpermissive · top 1,000 on PyPI
pbrpermissive · top 1,000 on PyPI
fakeredispermissive · top 1,000 on PyPI
humanfriendlypermissive · top 1,000 on PyPI
sshtunnelpermissive · top 1,000 on PyPI
seleniumpermissive · top 1,000 on PyPI