Registry / communication / inputs

inputs

JSON →
library0.5pypypi✓ verified 84d ago

Cross-platform Python library for reading input events from keyboards, mice, and gamepads. Version 0.5 provides a consistent API across Windows, Linux, and macOS via raw device access. Release cadence is low; last updated 2020.

pip install inputs
INSTALL
IMPORT
SIG · INPUTS
I
inputs
communicationpythonv0.5
Install
1.5s avg
Import
61ms
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.5 · 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.058s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.064s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

DeviceManager
from inputs import DeviceManager
Correct import path for accessing devices
get_key
from inputs import get_key
Function to read keyboard events
get_mouse
from inputs import get_mouse
Function to read mouse events
get_gamepad
from inputs import get_gamepad
Function to read gamepad events

Poll gamepad events in a loop. On Linux, ensure user has read permissions on /dev/input/event*.

from inputs import get_gamepad def main(): while True: events = get_gamepad() for event in events: print(event.ev_type, event.code, event.state) if __name__ == "__main__": main()
Debug
Known issues
gotchaOn Linux, event devices (e.g., /dev/input/event*) require read permissions. Run with sudo or add user to the 'input' group.
fix
sudo usermod -aG input $USER && log out and back in
affects: all
gotchaThe library does not support blocking reads; events are only returned when devices have been polled. Continuous polling may cause high CPU usage.
fix
Add a small sleep inside the loop, e.g., time.sleep(0.1)
affects: 0.x
deprecatedThe 'inputs' library is no longer actively maintained. Consider using 'pynput' or 'evdev' directly for future development.
fix
Migrate to pynput (pip install pynput) for cross-platform input control.
affects: 0.5
breakingmacOS support requires additional permissions and may not work without granting accessibility access to the terminal/IDE.
fix
Go to System Preferences > Security & Privacy > Privacy > Accessibility and add your terminal app.
affects: 0.5 (macOS)
Errors
Common errors & fixes
AttributeError: module 'inputs' has no attribute 'get_gamepad'
Older version of inputs or misspelled function name.
fix
Use 'from inputs import get_gamepad' (note: 'gamepad' not 'gamepad'). Check pip show inputs version >= 0.4.
PermissionError: [Errno 13] Permission denied: '/dev/input/event0'
User lacks read permissions on input device files on Linux.
fix
Run script with sudo or add user to 'input' group: sudo usermod -aG input $USER and re-login.
OSError: [Errno 19] No such device
No input device found (e.g., gamepad not connected or driver not loaded).
fix
Ensure the device is connected and recognized (ls /dev/input/ on Linux). On Windows, install drivers if needed.
Upgrade
Version history
0.5latest on PyPI · released Oct 5, 2018
Audit
Dependencies
evdevoptionalRequired on Linux for reading input events
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
inputs — pip install inputs · libregistry