Skip to content

Click 8.0.0 reports many mypy errors #1885

@lyz-code

Description

@lyz-code

Version 8.0.0 may have added some type hints that are making mypy complain of the following errors:

  • Untyped decorator makes function "X" untyped
  • Module has no attribute "X"
  • Unsupported target for indexed assignment ("Optional[Any]")

To replicate the bug follow the next steps in a clean virtualenv:

  • git clone https://github.com/lyz-code/drode
  • cd drode
  • make install
  • make mypy # it works without problem with version 7.1.2
  • pip install -U click
  • make mypy returns the following errors:
----------------
- Testing mypy -
----------------
mypy src tests
src/drode/entrypoints/cli.py:20: error: Untyped decorator makes function "cli" untyped  [misc]
src/drode/entrypoints/cli.py:20: error: Module has no attribute "group"; maybe "Group"?  [attr-defined]
src/drode/entrypoints/cli.py:21: error: Module has no attribute "version_option"  [attr-defined]
src/drode/entrypoints/cli.py:21: error: Untyped decorator makes function "cli" untyped  [misc]
src/drode/entrypoints/cli.py:22: error: Module has no attribute "option"; maybe "Option"?  [attr-defined]
src/drode/entrypoints/cli.py:22: error: Untyped decorator makes function "cli" untyped  [misc]
src/drode/entrypoints/cli.py:23: error: Module has no attribute "option"; maybe "Option"?  [attr-defined]
src/drode/entrypoints/cli.py:23: error: Untyped decorator makes function "cli" untyped  [misc]
src/drode/entrypoints/cli.py:30: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:30: error: Untyped decorator makes function "cli" untyped  [misc]
src/drode/entrypoints/cli.py:35: error: Unsupported target for indexed assignment ("Optional[Any]")  [index]
src/drode/entrypoints/cli.py:38: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:40: error: Unsupported target for indexed assignment ("Optional[Any]")  [index]
src/drode/entrypoints/cli.py:43: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:45: error: Unsupported target for indexed assignment ("Optional[Any]")  [index]
src/drode/entrypoints/cli.py:50: error: Untyped decorator makes function "set_active_project" untyped  [misc]
src/drode/entrypoints/cli.py:51: error: Module has no attribute "argument"; maybe "Argument"?  [attr-defined]
src/drode/entrypoints/cli.py:51: error: Untyped decorator makes function "set_active_project" untyped  [misc]
src/drode/entrypoints/cli.py:52: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:52: error: Untyped decorator makes function "set_active_project" untyped  [misc]
src/drode/entrypoints/cli.py:56: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:62: error: Untyped decorator makes function "get_active_project" untyped  [misc]
src/drode/entrypoints/cli.py:63: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:63: error: Untyped decorator makes function "get_active_project" untyped  [misc]
src/drode/entrypoints/cli.py:67: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:73: error: Untyped decorator makes function "wait_command" untyped  [misc]
src/drode/entrypoints/cli.py:74: error: Module has no attribute "argument"; maybe "Argument"?  [attr-defined]
src/drode/entrypoints/cli.py:74: error: Untyped decorator makes function "wait_command" untyped  [misc]
src/drode/entrypoints/cli.py:75: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:75: error: Untyped decorator makes function "wait_command" untyped  [misc]
src/drode/entrypoints/cli.py:79: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:80: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:81: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:88: error: Untyped decorator makes function "promote" untyped  [misc]
src/drode/entrypoints/cli.py:89: error: Module has no attribute "argument"; maybe "Argument"?  [attr-defined]
src/drode/entrypoints/cli.py:89: error: Untyped decorator makes function "promote" untyped  [misc]
src/drode/entrypoints/cli.py:91: error: Module has no attribute "Choice"  [attr-defined]
src/drode/entrypoints/cli.py:95: error: Module has no attribute "argument"; maybe "Argument"?  [attr-defined]
src/drode/entrypoints/cli.py:95: error: Untyped decorator makes function "promote" untyped  [misc]
src/drode/entrypoints/cli.py:96: error: Module has no attribute "option"; maybe "Option"?  [attr-defined]
src/drode/entrypoints/cli.py:96: error: Untyped decorator makes function "promote" untyped  [misc]
src/drode/entrypoints/cli.py:97: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:97: error: Untyped decorator makes function "promote" untyped  [misc]
src/drode/entrypoints/cli.py:103: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:104: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:106: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:110: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:117: error: Untyped decorator makes function "verify" untyped  [misc]
src/drode/entrypoints/cli.py:118: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:118: error: Untyped decorator makes function "verify" untyped  [misc]
src/drode/entrypoints/cli.py:123: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:124: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:130: error: Untyped decorator makes function "status" untyped  [misc]
src/drode/entrypoints/cli.py:131: error: Module has no attribute "pass_context"  [attr-defined]
src/drode/entrypoints/cli.py:131: error: Untyped decorator makes function "status" untyped  [misc]
src/drode/entrypoints/cli.py:135: error: Value of type "Optional[Any]" is not indexable  [index]
src/drode/entrypoints/cli.py:142: error: Untyped decorator makes function "null" untyped  [misc]
Found 57 errors in 1 file (checked 27 source files)

Upgrading click should not raise new mypy errors, or if it does, some guidelines on how to solve it could be added to the ugrading notes

Environment:

  • Python version: 3.7.3
  • Click version: 8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions