pynput
Monitor and control user input devices
Decision gist · record as of 2026-08-14
Yes, if you need cross-platform input control and monitoring. Pynput is stable, actively maintained, has no known vulnerabilities, and handles platform differences transparently. The LGPLv3 license is permissive for most use cases (including proprietary software) as long as you disclose the library and its modifications. Main caveat: Linux installations may require system development headers; plan for that in CI/CD or deployment.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- On Linux, requires libxlib development headers and evdev library; on macOS, requires Xcode command-line tools or pyobjc frameworks; Windows typically has no additional system requirements.
- Low install friction; distributed as a pure Python wheel.
- Depends on platform-specific libraries (pyobjc frameworks on macOS, evdev and python-xlib on Linux) that pip will pull automatically, but these may require system development headers on some Linux distributions.
License · maintenance · safety
LGPLv3 (copyleft) — Licensed under LGPLv3 (copyleft). You may use pynput in proprietary software, but any modifications to pynput itself must be released under the same license, and you must disclose the library's presence and provide access to its source.
last release 2026-05-12 (94 days) · last repo commit 2026-05-12 · 2,165 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,285,530 downloads/mo, #3,163 on PyPI
Alternatives
Verify before relying
from pynput.mouse import Controller, Button
from pynput.keyboard import Controller as KeyboardController
mouse = Controller()
mouse.position = (100, 100)
mouse.click(Button.left, 1)
keyboard = KeyboardController()
keyboard.type('Hello World')- Whether enum34 is still required for modern Python versions or is a legacy dependency
- Specific Python version floor and ceiling for version 1.8.2
- Whether the library works reliably in headless/server environments or requires an active display
What it is and what it does
Pynput is a cross-platform library for controlling and monitoring mouse and keyboard input devices from Python. It provides a Controller class to programmatically move the mouse, click buttons, type text, and press keys, as well as Listener classes to detect and react to mouse and keyboard events in real time. The library abstracts away platform differences—using native APIs on Windows, macOS, and Linux—so you write once and run on all three.
Typical use cases include automation scripts, testing frameworks that need to simulate user input, accessibility tools, and interactive applications that respond to keyboard or mouse events. The listener runs in a background thread and invokes callbacks for each event, while the controller lets you inject input as if a user had performed it. The library is mature (first released in 2015, marked Production/Stable) and actively maintained, with no known security vulnerabilities.
Use it for
- Automate repetitive UI tasks: script mouse clicks and keyboard input to control applications without modifying them.
- Test GUI applications: inject mouse and keyboard events to verify that user interfaces respond correctly to input.
- Build accessibility tools: monitor keyboard and mouse activity to create overlays, remapping utilities, or input assistants.
- Create interactive scripts: listen for keyboard shortcuts or mouse gestures to trigger custom actions in a background process.
- Develop game automation or bot tools: control game input and respond to on-screen events programmatically.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need cross-platform input control and monitoring.
Pynput is stable, actively maintained, has no known vulnerabilities, and handles platform differences transparently. The LGPLv3 license is permissive for most use cases (including proprietary software) as long as you disclose the library and its modifications. Main caveat: Linux installations may require system development headers; plan for that in CI/CD or deployment.
Install
pynput on PyPI
Before you install
Low install friction; distributed as a pure Python wheel. Depends on platform-specific libraries (pyobjc frameworks on macOS, evdev and python-xlib on Linux) that pip will pull automatically, but these may require system development headers on some Linux distributions.
On Linux, requires libxlib development headers and evdev library; on macOS, requires Xcode command-line tools or pyobjc frameworks; Windows typically has no additional system requirements.
License in practice
Licensed under LGPLv3 (copyleft). You may use pynput in proprietary software, but any modifications to pynput itself must be released under the same license, and you must disclose the library's presence and provide access to its source.
Quickstart
from pynput.mouse import Controller, Button
from pynput.keyboard import Controller as KeyboardController
mouse = Controller()
mouse.position = (100, 100)
mouse.click(Button.left, 1)
keyboard = KeyboardController()
keyboard.type('Hello World')
Verify before relying
- Whether enum34 is still required for modern Python versions or is a legacy dependency
- Specific Python version floor and ceiling for version 1.8.2
- Whether the library works reliably in headless/server environments or requires an active display
Package facts
| License | LGPLv3 copyleft |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagessixpyobjc-framework-ApplicationServicespyobjc-framework-Quartzevdevpython-xlibenum34 |
| Maintenance | Actively maintained 94 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,285,530 / month, #3,163 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)Operating System :: MacOS :: MacOS XOperating System :: Microsoft :: Windows :: Windows NT/2000Operating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Monitoring |
Evidence: pynput-1.8.2-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “mouse keyboard control python”
- pynputPynput lets you programmatically control and monitor mouse and…
- pynput-robocorp-forkControls and monitors mouse and keyboard input devices across…
- PyAutoGUIPyAutoGUI programmatically controls the mouse and keyboard across…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also inputs · pynput-robocorp-fork · sshkeyboard · PyAutoGUI · evdev · keyboard · PyAutoIt · PyDirectInput · MouseInfo · pywinauto