Skip to content
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

Pylance reports "reportUnusedImport" for symbols imported in __init__.py #446

Closed
Carsten-Leue opened this issue Oct 1, 2020 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Carsten-Leue
Copy link

Carsten-Leue commented Oct 1, 2020

Environment data

  • Language Server version: Pylance language server 2020.9.7 (pyright a0620921)
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.6

Expected behaviour

In my __init__.py file of a package I have this:

from typing import Tuple
from ._internal.async_di_context_impl import create_async_di_container
from ._internal.async_provider_impl import create_async_provider_definition

#: python nonsense
__all__: Tuple[str, ...] = (
    'create_async_di_container',
    'create_async_provider_definition'
)

I expect this not to show errors or warnings despite the symbols being unused. They are imported because they are re-exported by the package via the __all__ variable.

Actual behaviour

The import lines report a reportUnusedImport error.

image

image

@github-actions github-actions bot added the triage label Oct 1, 2020
@erictraut
Copy link
Contributor

Thanks for the bug report. This will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version labels Oct 1, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.10.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020100-7-october-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants