Registry / python-yakh

python-yakh

JSON →
library0.4.1pypypi✓ verified 82d ago

A cross-platform library for handling keypress events in the terminal. Supports both Unix and Windows systems. Current version: 0.4.1. Release cadence: irregular.

pip install python-yakh
INSTALL
IMPORT
SIG · PYTHON-YAKH
P
python-yakh
pythonv0.4.1
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

get_key
from yakh import get_key
from yakh import KeypressHandler
key
from yakh import key

Simple example: listen for keypresses for 5 seconds and print each key.

from yakh import KeypressHandler def on_key(key): print(f"Pressed: {key}") handler = KeypressHandler() handler.key_pressed += on_key handler.start() import time time.sleep(5) handler.stop()
Debug
Known issues
gotchaThe KeypressHandler runs in a separate thread. Ensure you stop the handler properly to avoid hanging processes. Always call handler.stop() before exiting.
fix
Use a try/finally block or context manager to stop the handler.
affects: all
gotchaOn Unix, the handler sets the terminal to raw mode. If the program crashes or exits without calling stop(), the terminal may be left in a broken state. Use atexit or signal handlers to restore terminal settings.
fix
Register handler.stop() with atexit.register() or use a context manager.
affects: all
deprecatedIn version 0.2.1 and earlier, the handler had a bug where the fd was not reset to blocking state. Make sure to use 0.2.1 or later.
fix
Upgrade to 0.2.1+ using pip install --upgrade python-yakh
affects: <0.2.1
Upgrade
Version history
0.4.1latest on PyPI · released Jan 14, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
python-yakh — pip install python-yakh · libregistry