Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update types to pass pyright --verifytypes click #2269

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

dzcode
Copy link
Contributor

@dzcode dzcode commented May 2, 2022

Fix the overwhelming majority of issues identified by pyright. The only remaining issues are of the form:

click.types.File.envvar_list_splitter
  /click/src/click/types.py:658:5 - error: Ambiguous base class override
    Type declared in base class is "str | None"
    Type inferred in child class is "str"
    Inferred child class type is missing type annotation and could be inferred differently by type checkers

Trying to correct this issue by adding an annotation conflicts with mypy, since mypy will then raise an error:

src/click/types.py:658: error: Cannot override class variable (previously declared on base class "ParamType") with instance variable  [misc]

I've left it so mypy remains passing.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@saroad2
Copy link
Collaborator

saroad2 commented May 7, 2023

Hello @dzcode and sorry for the long delay!

I'm currently walking through old PRs and reviewing them. In order to review this PR I would kindly ask you to fix the merge conflicts. Also, please check that your changes does make click pass the latest version of pyright.

After that, I will review this PR.

@davidism davidism added this to the 8.1.4 milestone Jun 30, 2023
@davidism davidism changed the base branch from main to 8.1.x June 30, 2023 00:30
@davidism
Copy link
Member

I've rebased this to 8.1.x and confirmed that pyright --verifytypes click passes. I also attempted to fix findings from pyright src (type checking Click itself rather than its interface), but it was not clear how to resolve 9 of the errors.

@davidism davidism changed the title Add typing to pass pyright update types to pass pyright --verifytypes click Jun 30, 2023
@davidism davidism merged commit dcdca58 into pallets:8.1.x Jun 30, 2023
12 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix pyright --verifytypes findings
3 participants