-
Notifications
You must be signed in to change notification settings - Fork 795
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
docstrings/type hints for .encode()
options
#2884
Comments
Is this something you can push a bit forward @binste? |
I like the idea. Maybe I can add the channels as explicitly listed arguments to |
In JupyterLab I can see the competion when clicking shift + tab, but due to ipython/ipykernel#1065 I have to assign to an intermediate object first: |
My current understanding is that many methods and classes in @utils.use_signature(core.FacetedEncoding)
def encode(self: _TEncodingMixin, *args: P.args, **kwargs: P.kwargs) -> _TEncodingMixin: This allows the completion in Jupyter (Jedi) to show the signature as shown in the screenshot of @joelostblom and even the relevant docstring. However, it does not give autocompletion support for keywords, e.g. if you start typing For autocompletion engines such as Pylance which is used in VS Code, this approach does not work. We already briefly discussed this in #2846. Reason is that Pylance uses a static type checker to infer types, signatures, docstrings, etc. The code is not executed and Potential approaches
I think getting this right would be a big usability increase for VS Code, PyCharm, and other similar editors and language servers as it not only affects |
@binste @joelostblom Is there an option to use this same sort of syntax for |
Thanks for linking the relevant PR and code @ChristopherDavisUCI! Overload works great for autocompletion engines such as the one used in VS Code. Indeed, this might be a good approach. Especially, if we could define those overload signatures in separate stub files to not have to modify api.py as described above. I aim to have a PR ready by Friday in the hope that it can still make it into rc1. Update: ParamSpec works great for this and is easy to add to the existing code base as it can be used on |
On the wishlist. I really like the merge of this PR #2846 by @binste. It really makes it possible to explore the options while building an altair specification.
Maybe it is not directly related, bit I wished that the possible options within the
.encode()
were similarly shown as well. Currently the possible encoding channels are presented as*args, **kwargs
:The text was updated successfully, but these errors were encountered: