-
Notifications
You must be signed in to change notification settings - Fork 43
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 type stubs #133
Comments
Yes, this would be great |
Intellisense/autocomplete doesnt work for me as well when working with the skia-python package on vscode .. please fix this probleme |
It has been some what annoying so far having to look back and forth between the documentation/api and my code just to know what returns and what methods the skia package gives. Will there be a fix for this soon? |
I tried
pip install mypy skia
stubgen -p skia -o . # Generates stubs in `./skia`
touch skia/py.typed # https://peps.python.org/pep-0561/
sed -i '' 's/Sk//g' skia/__init__.pyi # Removes the Sk prefix The generated Now I got type stubs that are somewhat useful for autocompletion and basic type check, but they still have many issues:
I hope this helps for someone who's willing to investigate it further. |
Is your feature request related to a problem? Please describe.
Intellisense/autocomplete doesn't work in Visual Studio Code when using Pylance as the language server.
It works when using Jedi or the Microsoft language server but it still has issues understanding the return types of functions.
Describe the solution you'd like
This is a known "issue" with Pylance, but they say it is a design choice. The solution should be to generate type stubs as discussed in this issue.
There is a discussion on how to automatically generate stubs for pybind11 here and the options seems to be either pybind11-stubgen or mypy's stubgen.
Describe alternatives you've considered
I could use a different LS such as Jedi but it's worse in general and there would still be issues.
Additional context
The text was updated successfully, but these errors were encountered: