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

CI: add pyright checking workflow #185

Merged
merged 8 commits into from
Jan 24, 2025
Merged

CI: add pyright checking workflow #185

merged 8 commits into from
Jan 24, 2025

Conversation

yanyongyu
Copy link
Owner

related to #184

@sterliakov
Copy link

This kind of diagnostic:

/home/runner/work/githubkit/githubkit/githubkit/versions/v2022_11_28/webhooks/pull_request.py:67:17 - error: Argument of type "UnionType" cannot be assigned to parameter "type_" of type "type[T@TaggedUnion]" in function "__init__"
  Type "UnionType" is not assignable to type "type[T@TaggedUnion]" (reportArgumentType)
Error: Argument of type "UnionType" cannot be assigned to parameter "type_" of type "type[T@TaggedUnion]" in function "__init__"

can be solved with a # type: ignore (probably preferred, this way it will work at least for "regular" classes passed), a tricky extra overload or Any. The future solution for exactly this kind of problem is TypeForm (PEP-741), but it isn't officially approved and stabilized yet.

Pyright has experimental support for TypeForm (with enableExperimentalFeatures), TypeForm can be imported from typing_extensions. But beware that

enableExperimentalFeatures [boolean]: [...] These features will likely change or be removed, so they should not be used except for experimentation purposes.

@yanyongyu yanyongyu merged commit 689cc1e into master Jan 24, 2025
35 of 37 checks passed
@yanyongyu yanyongyu deleted the ci/pyright branch January 24, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants