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

Generate .pyi files for enaml files #508

Open
MatthieuDartiailh opened this issue Oct 6, 2022 · 0 comments
Open

Generate .pyi files for enaml files #508

MatthieuDartiailh opened this issue Oct 6, 2022 · 0 comments

Comments

@MatthieuDartiailh
Copy link
Member

.enaml files appear completely opaques to most tools and while we cannot do much in a generic sense we could improve the user experience inside Python files using definition found in an enaml file by providing .pyi for enaml files.

The generation could be made from the AST generated by the parser:

  • for Python blocks we could empty the body of function nodes and simply unparse the AST (auto formatting after could handle messed up line numbers)
  • for enamldef we could use a class and generate type annotations for attr, aliases, and event and copy the annotations of declarative func. For attr, enaml syntax already has a type annotation, for aliases we would need to resolve to what the alias point to and if it is an atom member we should recover the matching type useful in an annotation, for event we would simply use the atom member
  • for template something similar could work too but it will need more thoughts
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

No branches or pull requests

1 participant