We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using Pylance on VSCode, and it doesn't autocomplete, for example, Accuracy even if I typed the following:
Accuracy
from torchmetrics import Ac
This is because imported symbols are considered private by default (by at least pylance (pyright) as documented here).
For better coding experience (autocomplete + docstring reference) :]
As stated in https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface, we have the following options to explicitly make symbols public.
__all__
__init__.py
# torchmetrics/__init__.py from torchmetrics.classification import ( Accuracy, ... ) __all__ = [ "Accuracy", ... ]
# torchmetrics/__init__.py from torchmetrics.classification import * # torchmetrics/classification/__init__.py __all__ = [ "Accuracy", ... ]
# torchmetrics/__init__.py from torchmetrics.classification import ( Accuracy as Accuracy, ... )
microsoft/pylance-release#1032 microsoft/pyright#1877
The text was updated successfully, but these errors were encountered:
Hi! thanks for your contribution!, great first issue!
Sorry, something went wrong.
@akihironitta sounds good to me :] I would prefer option 1 but have no strong opinions here.
akihironitta
Successfully merging a pull request may close this issue.
🚀 Feature (or Bug?)
I'm using Pylance on VSCode, and it doesn't autocomplete, for example,
Accuracy
even if I typed the following:This is because imported symbols are considered private by default (by at least pylance (pyright) as documented here).
Motivation
For better coding experience (autocomplete + docstring reference) :]
Pitch
As stated in https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface, we have the following options to explicitly make symbols public.
1. Add
__all__
to__init__.py
files.2. Use wildcard imports.
3. Use redundant symbol aliases.
Additional context
microsoft/pylance-release#1032
microsoft/pyright#1877
The text was updated successfully, but these errors were encountered: