Skip to content

Incompatibility with pyright 1.1.394 #2856

@adamtheturtle

Description

@adamtheturtle

I use pyright --verifytypes on a project which depends on click. I do not use --ignoreexternal.

With pyright==1.1.394 I started seeing errors.
These are related to how pyright considers instance variables without explicit types to be ambiguous. See https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#ambiguous-types.

click.core.Command.to_info_dict
  /Users/adam/Documents/repositories/doccmd/.venv/lib/python3.12/site-packages/click/core.py:1234:9 - error: Type of parameter "ctx" is partially unknown
    Parameter type is "Context"
click.formatting.HelpFormatter.current_indent
  /Users/adam/Documents/repositories/doccmd/.venv/lib/python3.12/site-packages/click/formatting.py:143:14 - error: Type is missing type annotation and could be inferred differently by type checkers
    Inferred type is "int"
click.core.Context.make_formatter
  /Users/adam/Documents/repositories/doccmd/.venv/lib/python3.12/site-packages/click/core.py:535:9 - error: Return type is partially unknown
    Return type is "HelpFormatter"
click.core.Command.get_usage

This also shows up in Click's CI when requirements/typing.txt is updated to the latest pyright.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions