-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
The file argument for click.secho is missing part of its typehint causing the entire secho function to be untyped.
This is not flagged by mypy strict mode, but does in pyright strict mode.
Install pyright and click
python -m venv .venv && source .venv/bin/activate
pip install click pyrightCreate a py file
# main.py
import click
click.secho("hello")Set pyright to strict mode
# pyproject.toml
[tool.pyright]
typeCheckingMode = "strict"Run pyright
pyright main.pyResult:
error: Type of "secho" is partially unknown
Type of "secho" is "(message: Any | None = None, file: IO[Unknown] | None = None, nl: bool = True, err: bool = False, color: bool | None = None, **styles: Any) -> None" (reportUnknownMemberType)The function should not produce a typing error. I will PR a fix for this momentarily.
Environment:
- Python version: 3.10.1
- Click version: 8.0.3
Reactions are currently unavailable