-
Notifications
You must be signed in to change notification settings - Fork 4
Modernize type hints #184
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
base: master
Are you sure you want to change the base?
Modernize type hints #184
Conversation
c5149f8 to
4093705
Compare
FichteFoll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these the official stubs from the ST distribution?
|
Took original sublime.py and sublime_types.py, modified type hints to more modern format and added additional hints to satisfy mypy. Existing sublime_plugin.pyi was extended by missing classes and methods from official sublime_plugin.py |
|
Perhaps we should add a mypy job to our PR lint workflow. |
c44e41c to
60b79f0
Compare
|
#187 has been merged, so this can be rebased now. |
60b79f0 to
f620db9
Compare
1. typing in sublime.py and sublime_plugin.py was extended to minimize linter/mypy warnings. 2. auto-generated stubs via mypy's stubgen script. 3. Merged with existing stubs for EventListeners - Source files are from ST4202. - Only public end-points are kept. Most internal functions, methods, etc. are removed from stubs.
1. Typing expects python 3.10+ type checker to be used.
2. Runtime code is maintained compatible with python 3.8
Note: Needs some compromises compared to modern py3.13 expectations of typing,
to maintain compatibility with py3.8
f620db9 to
a619375
Compare
FichteFoll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy complains about usages of defined_guard, but to get this right we need ParamSpec generics, I believe, and those need Python 3.10+. Can be addressed when we drop 3.8.
|
Any ideas how to solve those warnings are welcome. |
This PR...
There are some mypy errors, which may require further investigation about how to fix...
Example: