types-pynput
Typing stubs for pynput
What it is and what it does
types-pynput is a type stub package that provides type annotations for the pynput library. It allows static type checkers like mypy and pyright to understand and validate code that uses pynput's keyboard and mouse input APIs. The stubs are maintained as part of the typeshed project and are kept in sync with pynput version 1.8.1.
This package contains no runtime code—it exists purely to help your type checker understand pynput's API surface. You install it alongside pynput (or in your development environment) so that when you run type checking, the checker can verify that you're calling pynput functions correctly and with the right argument types.
Use it for:
- Enable mypy or pyright to catch type errors in code that controls keyboard or mouse input via pynput.
- Document the expected types for pynput function arguments and return values in an IDE with type-aware autocomplete.
- Enforce type safety in automation or testing scripts that use pynput for input simulation.
- Integrate pynput type checking into a CI/CD pipeline that runs static analysis on Python projects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides type hints for the pynput library, enabling static type checkers like mypy and pyright to validate code that uses pynput for keyboard and mouse input.
Yes, if you use pynput and run static type checking. It has no runtime cost, low install friction, and is actively maintained. Install it in your development or CI environment alongside pynput to catch type-related bugs early. Not necessary if you don't use a type checker or don't use pynput.
Install
types-pynput on PyPI
pip
pip install types-pynputuv
uv add types-pynputpoetry
poetry add types-pynputInstalling types-pynput
Before you install
Low friction—a pure stub package with no runtime dependencies. Actively maintained as part of typeshed, with recent releases and no known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
pip install types-pynput
# In your code, type checkers will now understand pynput imports:
from pynput.keyboard import Listener
from pynput.mouse import Controller
Requires Python 3.10 or later.
Verify before relying
- Whether pynput itself must be installed separately for these stubs to be useful in type checking workflows.
- Compatibility with type checkers other than mypy 2.2.0 and pyright 1.1.411.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 33 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 88,638/month — #13,711 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: types_pynput-1.8.1.20260712-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
types-pyserialProvides type hints for the pyserial library,…
permissive · top 5,000 on PyPI
types-click-spinnerProvides type stubs for the click-spinner…
permissive · top 15,000 on PyPI
types-MarkdownProvides type stubs for the Markdown package,…
permissive · top 5,000 on PyPI
types-requestsProvides type annotations for the requests…
permissive · top 1,000 on PyPI
types-pycurlProvides type hints for the pycurl HTTP client…
permissive · top 15,000 on PyPI
types-mypy-extensionsProvides type stubs for mypy-extensions,…
permissive · top 15,000 on PyPI
types-paramikoProvides type hints for paramiko, enabling…
permissive · top 1,000 on PyPI
types-pyflakesProvides type stubs for the pyflakes static…
permissive · top 15,000 on PyPI
types-decoratorProvides type stubs for the `decorator`…
permissive · top 5,000 on PyPI
types-PyYAMLProvides type stubs for PyYAML to enable static…
permissive · top 1,000 on PyPI