Closed nakamichiworks closed 1 month ago
Thanks for reaching out @nakamichiworks !
We use mypy
as our type checker, and when I run your example script with it, it doesn't flag any issues:
$ mypy script.py
Success: no issues found in 1 source file
Could this be an issue with pyright
rather than any issue with the way the type annotation is expressed?
Sorry I didn't notice the difference between mypy and pyright. I will look into the difference between the two type checkers in more detail.
That said, my proposal in https://github.com/dbt-labs/dbt-core/pull/10443 can satisfy both mypy and pyright.
The proposed usage of TypeVar
for class objects is even suggested in the official mypy docs.
Any reason or concern not to accept my proposal?
Thanks for that info @nakamichiworks -- just let us know what you find out in relation to the difference between mypy
and pyright
.
We can have one of our engineers take a look at your proposed change in https://github.com/dbt-labs/dbt-core/pull/10443 and see what they think too.
@nakamichiworks thank you for opening this and for for linking the mypy docs! Your proposed change looks good 👍
Is this a new bug in dbt-core?
Current Behavior
I want to use
WritableManifest
class to parse and analyzemanifest.json
of my dbt projects.However, code editor (vscode) and associated type checker (pyright) incorrectly infer the type of
WritableManifest
to beVersionedSchema
, which means that code completion does not work for the fields of the class.Expected Behavior
Instances of
WritableManifest
should be inferred to beWritableManifest
type.Steps To Reproduce
See the code snippet above.
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
Not relevant for this issue.
Additional Context
No response