--- id: pynput version: "1.8.2" license: LGPLv3 license_treatment: copyleft maintenance: active --- # pynput — Monitor and control user input devices License: copyleft · Maintenance: active · Downloads: 2.3M/mo ## 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 above — verify before relying. Pynput lets you programmatically control and monitor mouse and keyboard input across Windows, macOS, and Linux from Python code. 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 pip install pynput uv add pynput poetry add pynput ## Installing pynput 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. 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') 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. 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: unspecified - Install friction: low - Maintenance: active - Downloads: 2.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags mouse keyboard control python, input device automation, simulate mouse clicks keyboard, monitor keyboard mouse events, cross-platform input control, keyboard mouse listener, programmatic input injection, input-automation, cross-platform, gui-testing [View on SkillFed](https://skillfed.io/packages/pynput) · [View on PyPI](https://pypi.org/project/pynput/)