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-clickVerified import paths — ran on the pinned version, not inferred.
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.
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.
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'`).
Always import symbols from the actual `click` library (e.g., `from click import command`), not from `types_click`.