Skip to main content

Python-uinput is Python interface to Linux uinput kernel module which allows attaching userspace device drivers into kernel. In practice, Python-uinput makes it dead simple to create virtual joysticks, keyboards and mice for generating arbitrary input events programmatically.

Homepage:

https://github.com/pyinput/python-uinput

License:

GPLv3+

Usage examples

Generate keyboard clicks

import uinput

with uinput.Device([uinput.KEY_E, uinput.KEY_H,
                    uinput.KEY_L, uinput.KEY_O]) as device:
    device.emit_click(uinput.KEY_H)
    device.emit_click(uinput.KEY_E)
    device.emit_click(uinput.KEY_L)
    device.emit_click(uinput.KEY_L)
    device.emit_click(uinput.KEY_O)

Move mouse cursor

import uinput

with uinput.Device([uinput.REL_X, uinput.REL_Y,
                    uinput.BTN_LEFT, uinput.BTN_RIGHT]) as device:
    for i in range(20):
        device.emit(uinput.REL_X, 5)
        device.emit(uinput.REL_Y, 5)

Generate keyboard combinations

import uinput

with uinput.Device([uinput.KEY_LEFTALT, uinput.KEY_TAB]) as device:
    device.emit_combo([uinput.KEY_LEFTALT, uinput.KEY_TAB])

See examples/ for other kind of example devices (keyboard, joystick).

Note that you must have the uinput kernel module loaded to use python-uinput. To load the module, run:

modprobe -i uinput

If you would like to have uinput to be loaded on every sytem boot, add uinput to /etc/modules.

How to install

Just run the following commands:

python setup.py build
python setup.py install

How to report bugs

The bug database is hosted in GitHub. If you have found a bug or have an improvement idea you want to share, please report it at <https://github.com/pyinput/python-uinput/issues>. However, to avoid duplicate bug reports, before reporting, please check if similar or identical bug has already been reported. If so, you can still subscribe to the existing bug to track its progress.

How to contribute

In addition to reporting bugs and improvement suggestions, you are encouraged to contribute bug-fixes or features. The source code is maintained in Git and the main repository is hosted at GitHub, <https://github.com/pyinput/python-uinput/>. The preferred way to contribute code is to clone the main Git repository and send a pull-request. Good old patches via email are also accepted.

How to copy

Python-uinput is free (libre) software and licensed under the terms of GNU Public License version 3 or later. In short, it means that you are free to copy, modify and redistribute this software as long as you place the derivative work under a compatible license. See COPYING for details.

Metadata

Release files for python-uinput 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-uinput 1.0.1
File Size Uploaded Provenance Actions
python-uinput-1.0.1.tar.gz 41.4 kB Without provenance Details for python-uinput-1.0.1.tar.gz

Release files / python-uinput-1.0.1.tar.gz

Download URL python-uinput-1.0.1.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
853697344b64df5537d4ae32ba6fbcf0515d51a9010910f5d5019959038b6eba
BLAKE2b-256 checksum
How to use checksums
1d58f0ac92b19b3a9eda6a1d88d48bd17993d8a749600d981715b9be372ded5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.2

Security for python-uinput 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page