Typeshed stubs for pyperclip

raw JSON →
1.11.0.20260408 verified Mon Apr 27 auth: no python

Typing stubs for the pyperclip package, maintained as part of typeshed. Version 1.11.0.20260408 provides type annotations for pyperclip on Python >=3.10. Stubs are released as needed when pyperclip or typeshed changes; no fixed cadence.

pip install types-pyperclip
error Module 'pyperclip' has no attribute 'copy'
cause pyperclip not installed, only types-pyperclip.
fix
pip install pyperclip
error error: Cannot find implementation or library stub for module named 'pyperclip'
cause Missing pyperclip or missing types-pyperclip (or mypy cannot locate stubs).
fix
pip install pyperclip types-pyperclip and ensure mypy sees the site-packages.
gotcha types-pyperclip is a stub-only package. It does NOT replace pyperclip; you must install both pyperclip and types-pyperclip separately.
fix Install both: pip install pyperclip types-pyperclip
gotcha Stubs may not cover all platform-specific behaviors (e.g., Windows vs macOS vs Linux). The type annotations are generic.
fix Add type: ignore or assertions if needed for platform-specific code.
breaking As of types-pyperclip 1.11.0.20260408, the stubs require Python >=3.10. Older Python versions (3.8, 3.9) are no longer supported.
fix Pin to an older stubs version (e.g., pip install types-pyperclip==1.10.0.20250212) or upgrade Python to >=3.10.

Basic usage of pyperclip with type stubs. The stubs are automatically picked up by mypy/pyright when installed.

import pyperclip

pyperclip.copy('Hello, world!')
text = pyperclip.paste()
print(text)  # prints "Hello, world!"