readchar
Library to easily read single chars and key strokes
Decision gist · record as of 2026-08-14
Yes. readchar is stable, actively maintained, has zero dependencies, and solves a genuine problem for terminal applications. The MIT license is permissive, and the library's narrow scope and small footprint make it a low-risk addition. Install it if you need to handle raw keyboard input in a CLI or terminal UI.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a terminal that supports raw input mode; behavior is undefined when stdin is piped or redirected from a non-interactive source.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained as of 2026-04-06 with a stable release cadence.
License · maintenance · safety
permissive license (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
last release 2026-04-06 (130 days) · last repo commit 2026-04-06 · 180 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 15,794,533 downloads/mo, #1,172 on PyPI
Alternatives
Verify before relying
pip install readchar
import readchar
from readchar import readkey, key
while True:
k = readkey()
if k == key.DOWN:
print("Down arrow pressed")
elif k == key.ENTER:
break- Whether readkey() correctly handles all modifier combinations (CTRL+ALT) on all supported platforms
- Performance characteristics when reading from pipes or redirected input vs. interactive terminals
- Behavior on Android and FreeBSD/OpenBSD (listed as enabled but not actively tested)
What it is and what it does
readchar is a lightweight library for capturing keyboard input at the character and keystroke level in terminal applications. It abstracts away platform differences so you can read single keys, arrow keys, function keys, and modifier combinations (CTRL, ALT) in a portable way across Windows, Linux, and Unix. The library exposes two main functions: readchar() for single characters and readkey() for full keystrokes, plus a key module with named constants for special keys and a config class to customize interrupt behavior.
Typically used in interactive CLI tools, terminal UIs, and menu-driven applications where you need to respond to individual keypresses rather than waiting for a full line of input. It handles the low-level platform differences—Windows console APIs vs. Unix termios—so your code stays simple and portable.
Use it for
- Build interactive CLI menus that respond to arrow keys and Enter without waiting for line input
- Implement terminal-based games or interactive tools that need real-time keystroke detection
- Create command-line interfaces that handle function keys (F1–F12) for help or actions
- Capture CTRL and ALT key combinations in terminal applications for custom shortcuts
- Develop cross-platform terminal UIs that work identically on Windows and Linux
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
readchar is stable, actively maintained, has zero dependencies, and solves a genuine problem for terminal applications. The MIT license is permissive, and the library's narrow scope and small footprint make it a low-risk addition. Install it if you need to handle raw keyboard input in a CLI or terminal UI.
Install
readchar on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 2026-04-06 with a stable release cadence.
Requires a terminal that supports raw input mode; behavior is undefined when stdin is piped or redirected from a non-interactive source.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install readchar
import readchar
from readchar import readkey, key
while True:
k = readkey()
if k == key.DOWN:
print("Down arrow pressed")
elif k == key.ENTER:
break
Verify before relying
- Whether readkey() correctly handles all modifier combinations (CTRL+ALT) on all supported platforms
- Performance characteristics when reading from pipes or redirected input vs. interactive terminals
- Behavior on Android and FreeBSD/OpenBSD (listed as enabled but not actively tested)
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 130 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 15,794,533 / month, #1,172 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 :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software DevelopmentTopic :: Software Development :: User Interfaces |
Evidence: readchar-4.2.2-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 › “single character keystroke reader”
- readcharReads single characters and keystrokes from stdin, handling both…
- streamlit-keyupAdds real-time text input to Streamlit apps that fires on every…
- easyocrEasyOCR performs optical character recognition on images across 80+…
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 python-yakh · urwid-readline · pwinput · pinyin · Unidecode · anyascii · keyboard · chardet · streamlit-keyup · grapheme