{"id":24470,"library":"python-yakh","title":"Yet Another Keypress Handler","description":"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.","status":"active","version":"0.4.1","language":"python","source_language":"en","source_url":"https://github.com/petereon/yakh","tags":["keypress","terminal","input","cross-platform"],"install":[{"cmd":"pip install python-yakh","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from yakh import KeypressHandler","symbol":"get_key","correct":"from yakh import get_key"},{"symbol":"key","correct":"from yakh import key"}],"quickstart":{"code":"from yakh import KeypressHandler\n\ndef on_key(key):\n    print(f\"Pressed: {key}\")\n\nhandler = KeypressHandler()\nhandler.key_pressed += on_key\nhandler.start()\nimport time\ntime.sleep(5)\nhandler.stop()","lang":"python","description":"Simple example: listen for keypresses for 5 seconds and print each key."},"warnings":[{"fix":"Use a try/finally block or context manager to stop the handler.","message":"The KeypressHandler runs in a separate thread. Ensure you stop the handler properly to avoid hanging processes. Always call handler.stop() before exiting.","severity":"gotcha","affected_versions":"all"},{"fix":"Register handler.stop() with atexit.register() or use a context manager.","message":"On 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to 0.2.1+ using pip install --upgrade python-yakh","message":"In 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.","severity":"deprecated","affected_versions":"<0.2.1"}],"env_vars":null,"search_vec":"'0.4.1':25 'anoth':2 'cadenc':27 'cross':7,33 'cross-platform':6,32 'current':23 'event':13 'handl':11 'handler':4 'input':31 'irregular':28 'keypress':3,12,29 'librari':9 'platform':8,34 'releas':26 'support':17 'system':22 'termin':16,30 'unix':19 'version':24 'window':21 'yet':1","created_at":"2026-05-01T08:13:14.834522+00:00","updated_at":"2026-05-01T08:13:14.834522+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.4.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/petereon/yakh","docs":null,"changelog":null,"pypi":"https://pypi.org/project/python-yakh/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":[],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}