# pexpect/pexpect

A Python module for controlling interactive programs in a pseudo-terminal

Repository: https://github.com/pexpect/pexpect
Canonical: https://ross.abutalabs.com/products/pexpect
Homepage: http://pexpect.readthedocs.io/
Language: Python
License: NOASSERTION
License Family: other
Last push: 2025-04-11T06:56:25+00:00

## Health v2 (maintenance only)
Score: 30/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 16, release rhythm 8, longevity 100
- inputs: {"age_days": 4733, "days_push": 509, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2851, forks 494 (observed 2026-08-28T04:07:25.683774+00:00)

## What it is
Pexpect is a pure Python, Expect-like module for spawning and controlling interactive child applications in a pseudo-terminal. It lets scripts respond to expected output patterns as if a human were typing commands, automating tools like ssh, ftp, and passwd.

## Use cases
- automate interactive ssh sessions from python
- script password prompts for passwd or ftp
- run automated tests of command-line programs
- control a child process and respond to its output patterns
- automate setup scripts across servers
- drive telnet or other console applications programmatically

## When to choose
- you need to automate interactive Unix command-line programs that prompt for input
- you want a pure-Python alternative to Don Libes' Expect
- you are writing automated tests for terminal applications

## When to avoid
- you need full functionality on Windows, since pty-based features are Unix-only
- you just need to run non-interactive subprocesses, where subprocess is simpler
- you need to control GUI applications

## Facets
- artifact type: library
- maturity: stable
- function: workflow-automation, testing, cli, developer-tools
- domain: developer-tools, testing
- platform: python, cli
- tags: expect, pseudo-terminal, pty, process-control, interactive-applications, automation, command-line, linux, macos

## Member repositories
- pexpect/pexpect (main) score 30

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:25.683774+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:36:54.241983+00:00, confidence not recorded.
  - readme: https://github.com/pexpect/pexpect (fetched 2026-08-28T04:07:25.683774+00:00, sha e67d5ff14b46)
  - registry_pypi: https://pypi.org/pypi/pexpect/json (fetched 2026-08-29T09:53:06.515631+00:00, sha b2dc94cb45ad)
- Data as of 2026-08-30T08:39:29.467469+00:00.
