Registry / type-stubs / types-pynput

types-pynput

JSON →
library1.8.1.20260603pypypiunverified

This package provides type annotations (stubs) for the `pynput` library, allowing type checkers like mypy and pyright to validate code that uses pynput. Current version is 1.8.1.20260408, compatible with Python >=3.10. It is part of the typeshed project and is updated regularly to match upstream pynput releases.

pip install types-pynput
INSTALL
IMPORT
SIG · TYPES-PYNPUT
T
types-pynput
type-stubspythonv1.8.1.20260603
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.8.1.20260603 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

keyboard
✓ from pynput-stubs import keyboard
✗ from pynput import keyboard
mouse
✓ from pynput-stubs import mouse
✗ from pynput import mouse

Quickstart showing a basic keyboard listener with type stubs active.

from pynput import keyboard def on_press(key): try: print(f'Alphanumeric key pressed: {key.char}') except AttributeError: print(f'Special key pressed: {key}') with keyboard.Listener(on_press=on_press) as listener: listener.join()
Debug
Known issues
gotchatypes-pynput only provides type hints; it must be installed alongside the runtime library pynput. Running code without pynput will raise ImportError.
fix
Install both: pip install pynput types-pynput
affects: all
deprecatedIn some older stubs, importing directly from 'pynput' may not include submodule types. Always import from the specific submodule (e.g., 'from pynput import keyboard') to get correct type inference.
fix
Use explicit submodule imports: from pynput import keyboard, mouse
affects: all
Upgrade
Version history
1.8.1.20260603latest on PyPI · released Jun 3, 2026
Audit
Dependencies
pynputrequiredStubs only type-check code using pynput; pynput must be installed at runtime.
Agent activity
39 hits · last 30 days
node
32
OpenAI (training)
1
Resources
types-pynput — pip install types-pynput · libregistry