skillfed

python-yakh

Yet Another Keypress Handler

python-yakh v0.4.1 90.0K downloads/30d#13,624 on PyPI5
Permissive license MIT DORMANT released

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-yakh

uv

uv add python-yakh

poetry

poetry add python-yakh

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

terminal keypress capturestdin keyboard input handlercross-platform key detectionterminal key eventsread single keypresskeyboard input library
terminal-uikeyboard-input

More Terminals packages