Registry / http-networking / pyreadline

pyreadline

JSON →
library2.1pypiunverified

PyReadline (version 2.1) is a Python implementation of GNU readline functionality, primarily designed for Windows, to provide enhanced command-line editing features like history and tab completion. The project's last release was in 2015, and it is largely unmaintained. For users on Python 3.8 and newer, the community-maintained fork `pyreadline3` is the recommended alternative for compatible functionality.

pip install pyreadline
INSTALL
IMPORT
SIG · PYREADLINE
P
pyreadline
http-networkingenv2.1
Install
2.5s avg
Import
5ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.5s · import 0.001s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

readline
import readline
PyReadline, upon installation, creates a `readline.py` shim in site-packages to be imported as the standard `readline` module on Windows, allowing compatibility with modules like `rlcompleter`.

PyReadline primarily enhances the standard Python interactive prompt and the `input()` function on Windows. After installation, its features are generally active without explicit imports, though `import readline` will expose its API. This example demonstrates basic input and checks a `readline` function, noting potential compatibility issues with older versions.

import sys # pyreadline enhances the built-in input() function on Windows # if it's installed and correctly configured. # The primary use is passive: install it, and your Python REPL # and input() calls will have readline features. print('Type something (with history and tab completion if pyreadline is active):') try: user_input = input('>>> ') print(f'You typed: {user_input}') # Example of a readline function (available via the shim) # Requires pyreadline to be active and have bound these functions import readline # The following line might raise AttributeError if pyreadline isn't fully set up or patched print(f'Current history length: {readline.get_current_history_length()}') except EOFError: print('\nExiting.') except AttributeError as e: print(f'Readline attribute error: {e}. PyReadline might not be fully loaded or compatible with your Python version.') except Exception as e: print(f'An unexpected error occurred: {e}')
Debug
Known issues
breakingPyReadline 2.1 is not compatible with Python versions 3.10 and later. Users attempting to use it on these versions will encounter errors.
fix
Migrate to `pyreadline3` (`pip install pyreadline3`) for Python 3.8+ compatibility, or use an older Python version.
affects: Python 3.10+
deprecatedThe `pyreadline` project (version 2.1) has not been actively maintained since its last release in 2015. Many issues remain open, and it is considered stale.
fix
For active development and compatibility with modern Python, use `pyreadline3`.
affects: All versions
gotchaPython 3.9+ changed `collections.Callable` to `collections.abc.Callable`. Older `pyreadline` versions may raise `AttributeError` or `TypeError` due to this change if not patched.
fix
Consider switching to `pyreadline3` which addresses this, or manually patch `Lib/site-packages/pyreadline/py3k_compat.py` to use `collections.abc.Callable`.
affects: PyReadline 2.1 on Python 3.9+
gotchaPyReadline is specifically for Windows environments. On POSIX systems, Python typically uses GNU readline directly, and attempting to install or use `pyreadline` can lead to conflicts or errors.
fix
Only install `pyreadline` on Windows. On other operating systems, rely on the system's native readline implementation or use cross-platform alternatives like `prompt_toolkit`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'readline'
Attempting to import the `readline` module on Windows without `pyreadline` or `pyreadline3` installed, as `readline` is a POSIX-specific standard library module.
fix
Install `pyreadline` (for older Python) or `pyreadline3` (for Python 3.8+) on Windows: `pip install pyreadline` or `pip install pyreadline3`.
AttributeError: module 'readline' has no attribute 'redisplay'
This often occurs when `pyreadline` is installed but an application or a specific interaction attempts to call a `readline` function that `pyreadline` either doesn't implement or hasn't correctly exposed/bound. This can also be a symptom of general incompatibility or an incomplete setup.
fix
Ensure `pyreadline` is fully installed and try restarting the Python environment. If the issue persists, consider `pyreadline3` which might have better compatibility, or review specific usage patterns for `readline` features.
TypeError: 'type' object is not subscriptable (related to collections.Callable)
This error arises in Python 3.9 and later because `collections.Callable` was deprecated and then removed, replaced by `collections.abc.Callable`. PyReadline 2.1 uses the old path.
fix
Upgrade to `pyreadline3`, which is designed for newer Python versions, or manually edit the `pyreadline` source to replace `collections.Callable` with `collections.abc.Callable`.
Upgrade
Version history
2.1latest on PyPI · released Sep 16, 2015
Audit
Dependencies
ctypesrequiredUsed for low-level interaction on Windows; included with Python 2.5+.
Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

pyreadline — pip install pyreadline · libregistry