NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #243 most downloaded on PyPI
Pexpect allows easy control of interactive console applications.
Latest stable
4.9.0
Last release 3 years ago
no release in 18 months
Ships unpredictably
gaps range from 5 weeks to 3.8 years
Most releases are documented
notes for 16 of 20 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
20 releases · first in 2008
Drag across the ruler to compare, or tap a release to open it.
Remove deprecated RSAAuthentication option (SSHv1) (744).
Add support for Python 3.12 (769).
Clean up temporary files after UnicodeTests (753).
Add Python 3.5, 3.6 and 3.12.0-rc.1 to test matrix (763).
Set prompt correctly for zsh (712).
Add zsh convenience function to replwrap module (751).
Rework async unittests to rely on unittest.IsolatedAsyncioTestCase (764).
Make test_expect.py work on POSIX systems that are not Linux based (698).
Add support for socket, which allows sockets to be used crossplatform (745).
Update async to work on newer versions of python (732).
Remove deprecated RSAAuthentication option (SSHv1) (744).
Multiple CI fixes (743) (737) (742) (739) (722).
Use Github Actions for CI (734).
Remove pytest-capturelog from testing requirements (730).
Fix usage for Solaris (663) (604) (560).
Fix threading for new versions of python (684).
Fix documentation builds for use with Sphinx 3 (638).
Use sys.executable for tests and wrapper, allowing the calling python executable to be used instead (623).
Update documentation about Wexpect (623).
Added project urls to setup.py (620).
Provide examples for how to use Pexpect and Pyte (587).
Coerce compiled regex patterns type according to spawn encoding (560).
Several doc updates (626) (635) (643) (644) (728).
Returned behavior of searchwindowsize to that in 4.3 and earlier (searches are only done within the search window) (579).
Fixed a bug truncating before attribute after a timeout (579).
Fixed a bug where a search could be less than searchwindowsize if it was increased between calls (579).
Minor test cleanups to improve portability (580) (581) (582) (583) (584) (585).
Disable chaining of timeout and EOF exceptions (606).
Allow traceback included snippet length to be configured via str_last_chars rather than always 100 (598).
Python 3 warning added to interact.py (537).
Several doc updates.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Returned behavior of searchwindowsize to that in 4.3 and earlier (searches are only done within the search window) ( #579 ).
before attribute after a timeout (#579).searchwindowsize if it was increased between calls (#579).str_last_chars rather than always 100 (#598).The pxssh.login() method now no longer requires a username if an ssh config is provided and will raise an error if neither are provided. ( PR #562 ).
The pxssh.login() method now no longer requires a username if an ssh config is provided and will raise an error if neither are provided. ( PR #562 ).
The pxssh.login() method now supports providing your own ssh command via the cmd parameter. ( PR #528 ) ( PR #563 ).
pxssh now supports the use_poll parameter which is passed into pexpect.spawn() ( PR #542 ).
Minor bug fix with ssh_config . ( PR #498 ).
replwrap.run_command() now has async support via an async_ parameter. ( PR #501 ).
pexpect.spawn() will now read additional bytes if able up to a buffer limit. ( PR #304 ).
The .pxssh.login method now no longer requires a username if an ssh config is provided and will raise an error if neither are provided. (562).
The .pxssh.login method now supports providing your own ssh command via the cmd parameter. (528) (563).
.pxssh now supports the use_poll parameter which is passed into .pexpect.spawn (542).
Minor bug fix with ssh_config. (498).
.replwrap.run_command now has async support via an async_ parameter. (501).
.pexpect.spawn will now read additional bytes if able up to a buffer limit. (304).
The .pxssh.login method now supports an ssh_config parameter, which can be used to specify a file path to an SSH config file (490).
Improved compatibility for the crlf parameter of ~.PopenSpawn (493)
Fixed an issue in read timeout handling when using ~.spawn and ~.fdspawn with the use_poll parameter (492).
Version number -> 4.6
Version number -> 4.6
The pxssh.login() method now supports an ssh_config parameter, which can be used to specify a file path to an SSH config file ( PR #490 ).
Improved compatability for the crlf parameter of PopenSpawn ( PR #493 )
Fixed an issue in read timeout handling when using spawn and fdspawn with the use_poll parameter ( PR #492 ).
Clarify release notes for 4.5
Clarify release notes for 4.5
spawn and fdspawn now have a use_poll parameter. If this is True, they will use select.poll() instead of select.select() . poll() allows file descriptors above 1024, but it must be explicitly enabled due to compatibility concerns ( PR #474 ).
The pxssh.login() method has several new and changed options:
The option password_regex allows changing the password prompt regex, for servers that include password: in a banner before reaching a prompt ( PR #468 ).
login() now allows for setting up SSH tunnels to be requested once logged in to the remote server. This option is ssh_tunnels ( PR #473 ). The structure should be like this:
{ 'local' : [ '2424:localhost:22' ], # Local SSH tunnels 'remote' : [ '2525:localhost:22' ], # Remote SSH tunnels 'dynamic' : [ 8888 ], # Dynamic/SOCKS tunnels }
The option spawn_local_ssh=False allows subsequent logins from the remote session and treats the session as if it was local ( PR #472 ).
Setting sync_original_prompt=False will prevent changing the prompt to something unique, in case the remote server is sensitive to new lines at login ( PR #468 ).
If ssh_key=True is passed, the SSH client forces forwarding the authentication agent to the remote server instead of providing a key ( PR #473 ).
~.spawn and ~.fdspawn now have a use_poll parameter. If this is True, they will use select.poll instead of select.select. poll() allows file descriptors above 1024, but it must be explicitly enabled due to compatibility concerns (474).
The .pxssh.login method has several new and changed options:
The option password_regex allows changing the password prompt regex, for servers that include password: in a banner before reaching a prompt (468).
~.pxssh.login now allows for setting up SSH tunnels to be requested once logged in to the remote server. This option is ssh_tunnels (473). The structure should be like this:
{
'local': ['2424:localhost:22'], # Local SSH tunnels
'remote': ['2525:localhost:22'], # Remote SSH tunnels
'dynamic': [8888], # Dynamic/SOCKS tunnels
}
The option spawn_local_ssh=False allows subsequent logins from the remote session and treats the session as if it was local (472).
Setting sync_original_prompt=False will prevent changing the prompt to something unique, in case the remote server is sensitive to new lines at login (468).
If ssh_key=True is passed, the SSH client forces forwarding the authentication agent to the remote server instead of providing a key (473).
~.PopenSpawn now has a preexec_fn parameter, like ~.spawn and subprocess.Popen, for a function to be called in the child process before executing the new command. Like in Popen, this works only in POSIX, and can cause issues if your application also uses threads (460).
Significant performance improvements when processing large amounts of data (464).
Ensure that spawn.closed gets set by ~.spawn.close, and improve an example for passing SIGWINCH through to a child process (466).
Fix (hopefully) email address for PyPI upload
Fix (hopefully) email address for PyPI upload
PopenSpawn now has a preexec_fn parameter, like spawn and subprocess.Popen , for a function to be called in the child process before executing the new command. Like in Popen , this works only in POSIX, and can cause issues if your application also uses threads ( PR #460 ).
Significant performance improvements when processing large amounts of data ( PR #464 ).
Ensure that spawn.closed gets set by close() , and improve an example for passing SIGWINCH through to a child process ( PR #466 ).
Version number -> 4.3.1
Version number -> 4.3.1
When launching bash for pexpect.replwrap, load the system bashrc from a couple of different common locations (457), and then unset the PROMPT_COMMAND environment variable, which can interfere with the prompt we're expecting (459).
The async= parameter to integrate with asyncio has become async_= (431), as async is becoming a Python keyword from Python 3.6. Pexpect will still recognise async as an alternative spelling.
Similarly, the module pexpect.async became pexpect._async (450). This module is not part of the public API.
Fix problems with asyncio objects closing file descriptors during garbage collection (347, 376).
Set the .pid attribute of a ~.PopenSpawn object (417).
Fix passing Windows paths to ~.PopenSpawn (446).
~.PopenSpawn on Windows can pass string commands through to Popen without splitting them into a list (447).
Stop shlex trying to read from stdin when ~.PopenSpawn is passed cmd=None (433, 434).
Ensure that an error closing a Pexpect spawn object raises a Pexpect error, rather than a Ptyprocess error (383, 386).
Cleaned up invalid backslash escape sequences in strings (430, 445).
The pattern for a password prompt in pexpect.pxssh changed from password to password: (452).
Correct docstring for using unicode with spawn (395).
Various other improvements to documentation.
Version number -> 4.3
Version number -> 4.3
The async= parameter to integrate with asyncio has become async_= ( PR #431 ), as async is becoming a Python keyword from Python 3.6. Pexpect will still recognise async as an alternative spelling.
Similarly, the module pexpect.async became pexpect._async ( PR #450 ). This module is not part of the public API.
Fix problems with asyncio objects closing file descriptors during garbage collection ( #347 , PR #376 ).
Set the .pid attribute of a PopenSpawn object ( PR #417 ).
Fix passing Windows paths to PopenSpawn ( PR #446 ).
PopenSpawn on Windows can pass string commands through to Popen without splitting them into a list ( PR #447 ).
Stop shlex trying to read from stdin when PopenSpawn is passed cmd=None ( #433 , PR #434 ).
Ensure that an error closing a Pexpect spawn object raises a Pexpect error, rather than a Ptyprocess error ( #383 , PR #386 ).
Cleaned up invalid backslash escape sequences in strings ( PR #430 , PR #445 ).
The pattern for a password prompt in pexpect.pxssh changed from password to password: ( PR #452 ).
Correct docstring for using unicode with spawn ( PR #395 ).
Various other improvements to documentation.
Fix to allow running env in replwrap-ed bash.
Fix to allow running env in replwrap-ed bash.
Raise more informative exception from pxssh if it fails to connect.
Change passmass example to not log passwords entered.
Fix to allow running env in replwrap-ed bash.
Raise more informative exception from pxssh if it fails to connect.
Change passmass example to not log passwords entered.
Change: When an env parameter is specified to the ~.spawn or ~.run family of calls containing a value for PATH, its value is used to discover the target executable from a relative path, rather than the current process's environment PATH. This mirrors the behavior of subprocess.Popen in the standard library (348).
Regression: Re-introduce capability for read_nonblocking in class fdspawn as previously supported in version 3.3 (359).
Change: When an env parameter is specified to the spawn() or run() family of calls containing a value for PATH , its value is used to discover the tar
env parameter is specified to the spawn() orrun() family of calls containing a value for PATH, its value isPATH. This mirrors the behavior ofsubprocess.Popen in the standard library (PR #348).read_nonblocking() in classfdspawn as previously supported in version 3.3 (PR #359).Nothing published for this version
Nothing published for this version
Deprecated pexpect.screen and pexpect.ANSI . Please use other packages such as pyte to emulate a terminal.
Integration with asyncio : passing async=True to expect() , expect_exact() or expect_list() will make them return a coroutine. You can get the result using yield from , or wrap it in an asyncio.Task . This allows the event loop to do other things while waiting for output that matches a pattern.
Experimental support for Windows (with some caveats)—see Pexpect on Windows .
Enhancement: allow method as callbacks of argument events for pexpect.run() ( #176 ).
It is now possible to call wait() multiple times, or after a process is already determined to be terminated without raising an exception ( PR #211 ).
New pexpect.spawn keyword argument, dimensions=(rows, columns) allows setting terminal screen dimensions before launching a program ( #122 ).
Fix regression that prevented executable, but unreadable files from being found when not specified by absolute path – such as /usr/bin/sudo ( #104 ).
Fixed regression when executing pexpect with some prior releases of the multiprocessing module where stdin has been closed ( #86 ).
Deprecated pexpect.screen and pexpect.ANSI . Please use other packages such as pyte to emulate a terminal.
Removed the independent top-level modules ( pxssh fdpexpect FSM screen ANSI ) which were installed alongside Pexpect. These were moved into the Pexpect package in 3.0, but the old names were left as aliases.
Child processes created by Pexpect no longer ignore SIGHUP by default: the ignore_sighup parameter of pexpect.spawn defaults to False. To get the old behaviour, pass ignore_sighup=True .
Integration with asyncio: passing async=True to ~.spawn.expect, ~.spawn.expect_exact or ~.spawn.expect_list will make them return a coroutine. You can get the result using yield from, or wrap it in an asyncio.Task. This allows the event loop to do other things while waiting for output that matches a pattern.
Experimental support for Windows (with some caveats)—see windows.
Enhancement: allow method as callbacks of argument events for pexpect.run (176).
It is now possible to call ~.spawn.wait multiple times, or after a process is already determined to be terminated without raising an exception (211).
New pexpect.spawn keyword argument, dimensions=(rows, columns) allows setting terminal screen dimensions before launching a program (122).
Fix regression that prevented executable, but unreadable files from being found when not specified by absolute path -- such as /usr/bin/sudo (104).
Fixed regression when executing pexpect with some prior releases of the multiprocessing module where stdin has been closed (86).
Deprecated pexpect.screen and pexpect.ANSI. Please use other packages such as pyte to emulate a terminal.
Removed the independent top-level modules (pxssh fdpexpect FSM screen ANSI) which were installed alongside Pexpect. These were moved into the Pexpect package in 3.0, but the old names were left as aliases.
Child processes created by Pexpect no longer ignore SIGHUP by default: the ignore_sighup parameter of pexpect.spawn defaults to False. To get the old behaviour, pass ignore_sighup=True.
Added a mechanism to wrap REPLs, or shells, in an object which can conveniently be used to send commands and wait for the output (pexpect.replwrap).
Fixed issue where pexpect would attempt to execute a directory because it has the 'execute' bit set (37).
Removed the pexpect.psh module. This was never documented, and we found no evidence that people use it. The new pexpect.replwrap module provides a more flexible alternative.
Fixed TypeError: got <type 'str'> ('\r\n') as pattern in spawnu.readline method (67).
Fixed issue where EOF was not correctly detected in ~.interact, causing a repeating loop of output on Linux, and blocking before EOF on BSD and Solaris (49).
Several Solaris (SmartOS) bugfixes, preventing IOError exceptions, especially when used with cron(1) (44).
Added new keyword argument echo=True for spawn. On SVR4-like systems, the method ~.isatty will always return False: the child pty does not appear as a terminal. Therefore, ~.setecho, ~.getwinsize, ~.setwinsize, and ~.waitnoecho are not supported on those platforms.
After this, we intend to start working on a bigger refactoring of the code, to be released as Pexpect 4. There may be more bugfix 3.x releases, however.
Added a mechanism to wrap REPLs, or shells, in an object which can conveniently be used to send commands and wait for the output ( pexpect.replwrap ).
Added a mechanism to wrap REPLs, or shells, in an object which can conveniently be used to send commands and wait for the output ( pexpect.replwrap ).
Fixed issue where pexpect would attempt to execute a directory because it has the ‘execute’ bit set ( #37 ).
Removed the pexpect.psh module. This was never documented, and we found no evidence that people use it. The new pexpect.replwrap module provides a more flexible alternative.
Fixed TypeError: got <type 'str'> ('\r\n') as pattern in spawnu.readline() method ( #67 ).
Fixed issue where EOF was not correctly detected in interact() , causing a repeating loop of output on Linux, and blocking before EOF on BSD and Solaris ( #49 ).
Several Solaris (SmartOS) bugfixes, preventing IOError exceptions, especially when used with cron(1) ( #44 ).
Added new keyword argument echo=True for spawn . On SVR4-like systems, the method isatty() will always return False : the child pty does not appear as a terminal. Therefore, setecho() , getwinsize() , setwinsize() , and waitnoecho() are not supported on those platforms.
After this, we intend to start working on a bigger refactoring of the code, to be released as Pexpect 4. There may be more bugfix 3.x releases, however.
Fix exception handling from select.select() on Python 2 ( PR #38 ). This was accidentally broken in the previous release when it was fixed for Python
Fix exception handling from select.select() on Python 2 ( PR #38 ). This was accidentally broken in the previous release when it was fixed for Python 3.
Removed a workaround for TIOCSWINSZ on very old systems, which was causing issues on some BSD systems ( PR #40 ).
Fixed an issue with exception handling in pxssh ( PR #43 )
The documentation for pxssh was improved.
Fix exception handling from select.select on Python 2 (38). This was accidentally broken in the previous release when it was fixed for Python 3.
Removed a workaround for TIOCSWINSZ on very old systems, which was causing issues on some BSD systems (40).
Fixed an issue with exception handling in ~pexpect.pxssh (43)
The documentation for ~pexpect.pxssh was improved.
Fix an issue that prevented importing pexpect on Python 3 when sys.stdout was reassigned (30).
Improve prompt synchronisation in ~pexpect.pxssh (28).
Fix pickling exception instances (34).
Fix handling exceptions from select.select on Python 3 (33).
The examples have also been cleaned up somewhat - this will continue in future releases.
Fix an issue that prevented importing pexpect on Python 3 when sys.stdout was reassigned ( #30 ).
Fix an issue that prevented importing pexpect on Python 3 when sys.stdout was reassigned ( #30 ).
Improve prompt synchronisation in pxssh ( PR #28 ).
Fix pickling exception instances ( PR #34 ).
Fix handling exceptions from select.select() on Python 3 ( PR #33 ).
The examples have also been cleaned up somewhat - this will continue in future releases.
The new major version number doesn’t indicate any deliberate API incompatibility. We have endeavoured to avoid breaking existing APIs. However, pexpec
The new major version number doesn’t indicate any deliberate API incompatibility. We have endeavoured to avoid breaking existing APIs. However, pexpect is under new maintenance after a long dormancy, so some caution is warranted.
A new unicode API was introduced.
Python 3 is now supported, using a single codebase.
Pexpect now requires at least Python 2.6 or 3.2.
The modules other than pexpect, such as pexpect.fdpexpect and pexpect.pxssh , were moved into the pexpect package. For now, wrapper modules are installed to the old locations for backwards compatibility (e.g. import pxssh will still work), but these will be removed at some point in the future.
Ignoring SIGHUP is now optional - thanks to Kimmo Parviainen-Jalanko for the patch.
We also now have docs on ReadTheDocs , and continuous integration on Travis CI .
The new major version number doesn't indicate any deliberate API incompatibility. We have endeavoured to avoid breaking existing APIs. However, pexpect is under new maintenance after a long dormancy, so some caution is warranted.
A new unicode API was introduced.
Python 3 is now supported, using a single codebase.
Pexpect now requires at least Python 2.6 or 3.2.
The modules other than pexpect, such as pexpect.fdpexpect and pexpect.pxssh, were moved into the pexpect package. For now, wrapper modules are installed to the old locations for backwards compatibility (e.g. import pxssh will still work), but these will be removed at some point in the future.
Ignoring SIGHUP is now optional - thanks to Kimmo Parviainen-Jalanko for the patch.
We also now have docs on ReadTheDocs, and continuous integration on Travis CI.
Fix a bug regarding making the pty the controlling terminal when the process spawning it is not, actually, a terminal (such as from cron)
Fix a bug regarding making the pty the controlling terminal when the process spawning it is not, actually, a terminal (such as from cron)
Nothing published for this version
Nothing published for this version
One column per quarter.