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

Support features about export (__all__) #185

Closed
jeongukjae opened this issue Aug 9, 2019 · 6 comments
Closed

Support features about export (__all__) #185

jeongukjae opened this issue Aug 9, 2019 · 6 comments
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request

Comments

@jeongukjae
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of the problem.

from .some_packages import some_function

__all__ = ["some_function"]

I think above code should not raise any warnings nor errors, but pyright 1.0.53 raises an error like error: Import 'some_function' is not accessed.

A static analyzer may not fully support this feature because value of __all__ can be dynamic. But it would be much better if pyright supports this feature even though partially.

@jeongukjae jeongukjae added the enhancement request New feature or request label Aug 9, 2019
@erictraut
Copy link
Collaborator

Thanks for the suggestion. This will be included in the next version of pyright.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Aug 9, 2019
@giyyapan
Copy link

giyyapan commented Aug 9, 2019

microsoft/python-language-server#619

FYI, python-language-server removed support of __all__ for reason:

commonly used libraries are using it in ways we can't handle yet.

Not sure what's those libraries and how they can't handle.

@erictraut
Copy link
Collaborator

Yeah, I'm not planning to honor __all__ in terms of import mechanics, but I think it's reasonable to mark the referenced symbols as "accessed" so pyright doesn't report them as unaccessed.

@giyyapan
Copy link

giyyapan commented Aug 9, 2019

Fair point.

Didn't read the issue description clearly enough and thought those two issue were simillar.

@erictraut
Copy link
Collaborator

This support is included in 1.0.54, which I just published.

@jeongukjae
Copy link
Author

I installed new version and checked it working well!! Thank you for maintaining this amazing project!

heejaechang pushed a commit to heejaechang/pyright that referenced this issue Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version enhancement request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants