python-yakh
Yet Another Keypress Handler
What it is and what it does
yakh is a minimal terminal keypress handler that reads individual key events from stdin and returns them as Key objects. It abstracts away platform differences so you can detect keypresses—including special keys like CTRL combinations—without managing raw terminal modes yourself. The library has no runtime dependencies and exposes a single blocking function, `get_key()`, that returns a Key instance with the pressed key's character representation, Unicode code points, and a printability flag.
Typical use is in terminal user interfaces or interactive CLI tools where you need to respond to individual keypresses rather than waiting for a full line of input. The Key class is comparable to strings and Unicode tuples, making it easy to check for specific keys or key combinations. Platform-specific key constants are available through the `Keys` class for common keys like ENTER and CTRL variants.
Use it for:
- Build interactive terminal menus or games that respond to single keypresses without waiting for Enter.
- Implement keyboard shortcuts in CLI tools (e.g., 'q' to quit, arrow keys to navigate).
- Create terminal-based input handlers that need to detect special keys like CTRL+C or function keys.
- Develop cross-platform terminal applications that handle keypresses consistently on Windows, macOS, and Linux.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Captures individual keypresses from terminal stdin in a platform-independent way, returning key objects with character data, Unicode code points, and printability information.
Yes, if you need simple cross-platform keypress handling in a terminal. The zero-dependency design and low install friction make it lightweight. However, maintenance is dormant—last commit was 2025-01-14 with no recent releases—so expect no active bug fixes or feature development. Suitable for small projects or scripts; for production systems requiring ongoing support, evaluate alternatives or plan to maintain a fork.
Install
python-yakh on PyPI
pip
pip install python-yakhuv
uv add python-yakhpoetry
poetry add python-yakhInstalling python-yakh
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last commit was 2025-01-14 but no release since then; the package works on modern Python versions (3.8–3.13) but receives infrequent updates.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install python-yakh
from yakh import get_key
from yakh.key import Keys
key = get_key() # blocks until a key is pressed
if key.is_printable:
print(key)
Requires a terminal environment with stdin access; behavior is platform-dependent for special keys like CTRL combinations.
Verify before relying
- Whether the package handles all terminal emulators consistently (Windows, macOS, Linux).
- Performance characteristics when called in tight loops or high-frequency polling scenarios.
- Compatibility with non-ASCII input or IME (input method editor) systems.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0.0,>=3.7.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 577 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 89,989/month — #13,624 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_yakh-0.4.1-py3-none-any.whl
Keywords: python, keypress, key, keyboard
Tags
More Terminals packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
wcwidthMeasures the displayed width of Unicode strings…
permissive · top 1,000 on PyPI
ptyprocessRun a subprocess in a pseudo terminal (pty) and…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
readcharReads single characters and keystrokes from…
permissive · top 5,000 on PyPI
win_unicode_consoleFixes Unicode input and display in Python when…
permissive · top 15,000 on PyPI
keysymdefProvides X11 and XF86 keysym definitions as…
unclear · top 15,000 on PyPI
blessedBlessed provides a clean Python interface for…
permissive · top 5,000 on PyPI
exit-codesProvides platform-independent exit codes for…
permissive · top 15,000 on PyPI
keyboardHook global keyboard events, register hotkeys,…
permissive · top 5,000 on PyPI
pynputPynput lets you programmatically control and…
copyleft · top 5,000 on PyPI
asciimaticsAsciimatics provides cross-platform terminal UI…
permissive · top 15,000 on PyPI
inputsProvides cross-platform Python access to…
permissive · top 15,000 on PyPI
sshkeyboardCaptures keyboard input via callbacks in SSH…
permissive · top 15,000 on PyPI