Restrict top-level autocompletion for VS Code (PyLance) #2927
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, this PR is only meant to show some code related to discussions happening in #2918, microsoft/pylance-release#3709 (reply in thread) and #2614.
As described in https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface, I expanded the wildcard import from vegalite and added
py.typed
. However,selection
still shows up in autocompletion although it should be considered private by PyLance as it is not mentioned in__all__
:Opening
altair/__init__.py
in VS Code shows that PyLance is aware that it should be private so this is somehow ignored by the code completion?Before this approach could be merged, we'd need to:
py.typed
. Altair is far off from being “type complete” as it is described here. Maybe what we want to achieve is possible without addingpy.typed
for now?from .vegalite import *