Registry / type-stubs / types-click

types-click

JSON →
library7.1.8pypypi✓ verified 25d ago

types-click is a PEP 561 type stub package providing external type annotations for the popular Click library. It allows type-checking tools like MyPy, PyCharm, and Pyright to analyze code that uses Click, enabling static analysis, type inference, and autocompletion. Maintained as part of the broader typeshed project, its releases generally follow the versions of the Click library it stubs, with an additional datestamp suffix.

pip install types-click
INSTALL
IMPORT
SIG · TYPES-CLICK
T
types-click
type-stubspythonv7.1.8
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.1.8 · 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.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.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.

click-stubs
import click_stubs
import click-stubs

This example demonstrates a basic Click CLI application with type hints. When `types-click` is installed, a type checker like MyPy will use its stubs to validate the types in this code.

import click @click.command() @click.option('--name', default='World', help='The name to greet.') @click.option('--count', default=1, type=int, help='Number of greetings.') @click.argument('message', default='Hello', type=str) def greet(name: str, count: int, message: str): """ Simple program that greets NAME for COUNT times with a MESSAGE. """ for _ in range(count): click.echo(f"{message}, {name}!") if __name__ == '__main__': # Type checkers will use types-click for 'click' objects and functions. greet() # type: ignore
Debug
Known issues
breakingClick versions 8.0 and newer include inline type annotations. If you are using `click` version 8.0 or later, `types-click` is no longer necessary and should be uninstalled. Installing both can lead to type checking conflicts or incorrect type information.
fix
Uninstall `types-click` (`pip uninstall types-click`) if `click` version 8.0 or higher is installed in your environment. Rely on the inline types provided by `click` itself.
affects: click >= 8.0
gotchaThe `types-click` package provides stubs for specific versions of the `click` library. While its version attempts to match the `click` version (e.g., `types-click==7.1.x` for `click==7.1.x`), discrepancies can occur. Using `types-click` with a significantly different `click` version than it was designed for can lead to inaccurate or misleading type checking results.
fix
Ensure your `types-click` version is compatible with your installed `click` version. Typeshed generally recommends using the same version bounds for the stub package as for the runtime package (e.g., `pip install 'click>=7.1.0,<8.0.0' 'types-click>=7.1.0,<8.0.0'`).
affects: All versions
gotchaAs a PEP 561 stub-only package, `types-click` contains no runtime code. It only provides `.pyi` files for type checkers. Attempting to import symbols directly from `types_click` at runtime will result in a `ModuleNotFoundError`.
fix
Always import symbols from the actual `click` library (e.g., `from click import command`), not from `types_click`.
affects: All versions
Upgrade
Version history
7.1.8latest on PyPI · released Nov 23, 2021
Audit
Dependencies
clickrequiredThis package provides type stubs for the 'click' library. 'click' itself is required at runtime for the stubs to be useful for type checking your application code.
Agent activity
39 hits · last 30 days
node
36
OpenAI (training)
1
Resources
types-click — pip install types-click · libregistry