I've a RaspberryPi 3 which will be used headless, and am using https://github.com/adafruit/Adafruit_DotStar_Pi for controlling LEDs, which constrains me to using Python 2. The LEDs are pretty much the only output of my device, and a single key (specifically a 'w' from a Bluefruit EZ-Key Bluetooth HID Keyboard Controller) is the only input - basically activating or deactivating the lights.
I want to have a callback function be called when a keypress event is detected, to change some state, but all available methods I've found so far (ie reading from /dev/input/event0) seem to be blocking. The python-evdev module looks useful, but all the async options appear to be Python 3.
In the GPIO python library (which works fine in Python 2) there are callback functions for when a pin changes state, so I guess I'm hoping that there is a similar API for detecting keypress events.
The code will be running in a systemd process, and it seems reading from /dev/input/event0 is more likely to get me useful key events than stdin (which doesn't seem to be hooked up to detect keypresses in systemd processes).
(This question was off-topic for https://raspberrypi.stackexchange.com/ btw )