-
Notifications
You must be signed in to change notification settings - Fork 405
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
Tool for generating schema type annotations #7186
base: master
Are you sure you want to change the base?
Conversation
The verdict here is:
|
133c311
to
a1ca831
Compare
ae8475b
to
01a40c4
Compare
@msullivan, can you have a look into why mypy is failing? A new realization is that that if I disable our plugin, the internal error disappears. I've also figured that if I disable https://github.com/edgedb/edgedb/blob/schema-type-annotations/edb/tools/mypy/plugin.py#L73-L82 |
I've tested out performance impact of this change. Currently, there are a few commits on this PR, starting with the most basic setup and then optimizing from there:
The |
Our schema classes have generated getter methods for each of the fields:
This PR adds a tool that generates
.pyi
files inedb/schema/
, which contain definitions for all of these generated getters.We do have mypy extension that already picks-up these getters, even without
.pyi
definitions.Regardless, this
.pyi
approach is useful because language servers (PyLance) cannot use mypy extension. Now, "go to definition", "show usages" and other code actions work.There is a few drawbacks:
get_subjectexpr
returnsExpression
, but it will infer type ofsubjexpr
to beAny
. What?Because of these drawbacks, #7166 is still useful.