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
Typehinting for IDE suggestions. #10
Comments
Well, I don't use IDEs with autocompletion - so I couldn't really test yet - what are you using? Do you have any pointers to the documentation what the autocomplete expects from a participating library? In general, I think it would be rad to have autocomplete as that would make the library much more discoverable. I tend to use new libraries on a python-prompt to use introspection to understand how the libraries work, as there are still many (as you have discovered) concepts that an autocomplete can't grasp. I would guess that executable modules may in general be problematic for autocomplete, as they pretty much require the execution of the code, as just parsing the AST doesn't expose that the module is (replaced at runtime) by a callable - but maybe there's a way to signal that to the autocompleter? |
I'm using VSCode with the Pylance language server, which is based on Pyright.
There's a bunch of PEPs that outline type hinting and related topics, I think a good idea would be to look at what Pyright implements: https://github.com/microsoft/pyright Generally though, all of these tools will use python type hints, there's a great list of typing related thigns here: https://github.com/typeddjango/awesome-python-typing#articles I have no idea for type checkers handling callable modules, there might be a way to typehint that it is callable, but I'm not sure. |
Well, because I could…, also Well, maybe making the module executable wasn't so good an Idea, but I really liked it a the time. :/ I'll have a look at these autocompleters soon and see what can be done. In the meantime, I'll welcome more discussion and deeper pointers. |
Hey there,
i love the idea of this library. One issue though: there are no IDE autocomplete suggestions when using this.
I managed to get rudimentary suggestions to work by changing wrap to this:
sadly, this means i have to
from fluentpy.wrapper import wrap as _
since type checkers dont understand the concept of a callable module, at least not the way you've done it. on the upside, i get autocomplete suggestions!Would it be possible to add this to the library, maybe a bit more extensive to be able to see the Wrapper methods like .each? Maybe there's even a way to get it to work with the direct module import?
The text was updated successfully, but these errors were encountered: