axidev-io is a Python package for keyboard automation and global keyboard event listening.
It wraps the native axidev-io library and keeps the same high-level shape as the JS bindings:
keyboard.initialize(...)keyboard.sender.tap(...)keyboard.sender.type_text(...)keyboard.listener.start(...)keyboard.keys.parse(...)keyboard.setup_permissions()
The PyPI distribution name is axidev-io.
The Python import name is axidev_io.
pip install axidev-ioThe source distribution builds the native extension from the checked-out
vendor/axidev-io git submodule.
Supported platforms:
- Linux
- Windows
Build-time requirements:
pkg-config- development packages for
libinput,libudev, andxkbcommon - a working C toolchain
Runtime requirements:
- system shared libraries for
libinput,libudev, andxkbcommon - access to
/dev/uinputfor key injection - access to the relevant
/dev/input/event*devices for listening
Those Linux backend dependencies are intentionally expected from the system and must remain dynamically linked for legal/compliance reasons.
Windows builds use the normal Python extension toolchain and link against system Win32 libraries.
from axidev_io import keyboard
permissions = keyboard.setup_permissions()
if permissions.requires_logout:
print("Log out and back in, then run again.")
raise SystemExit(0)
keyboard.initialize(key_delay_us=2000)
keyboard.sender.type_text("Hello from axidev-io")
keyboard.sender.tap("Ctrl+Shift+P")
stop = keyboard.listener.start(lambda event: print(event.combo, event.pressed, event.text))
try:
...
finally:
stop()
keyboard.shutdown()Main entrypoints:
keyboard.initialize(...)keyboard.shutdown()keyboard.setup_permissions()keyboard.status()keyboard.version()keyboard.is_log_enabled(level)keyboard.log_message(level, message)
Sender methods:
keyboard.sender.tap(input, mods=None)keyboard.sender.key_down(input, mods=None, repeat=True)keyboard.sender.key_repeat(input, mods=None)keyboard.sender.key_up(input, mods=None)keyboard.sender.type_text(text)keyboard.sender.type_character(input)keyboard.sender.hold_modifiers(mods)keyboard.sender.release_modifiers(mods)keyboard.sender.release_all_modifiers()keyboard.sender.flush()
Listener methods:
keyboard.listener.start(callback)keyboard.listener.stop()
Key helpers:
keyboard.keys.parse(name)keyboard.keys.format(key)keyboard.keys.parse_combo(text)keyboard.keys.format_combo(input, mods=None)keyboard.keys.modifiers.resolve(mods)keyboard.keys.modifiers.to_names(mask)
The installed package ships the upstream consumer and license material under axidev_io/vendor/axidev-io/, including:
docs/consumers/README.mdscripts/setup_uinput_permissions.shLICENSEvendor/licenses/stb.txt
Useful local commands:
git submodule update --init --recursive
git submodule update --remote vendor/axidev-io
python scripts/sync_upstream.py
python -m pip install -e .
python -m buildThe vendor/axidev-io submodule tracks the upstream release branch. After
updating the submodule, run python scripts/sync_upstream.py to refresh the
package-shipped compliance assets under src/axidev_io/vendor/axidev-io/.