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

Hide Query, QueryType typevars in .pyi #431

Closed
uwinx opened this issue Mar 15, 2020 · 1 comment · Fixed by #475
Closed

Hide Query, QueryType typevars in .pyi #431

uwinx opened this issue Mar 15, 2020 · 1 comment · Fixed by #475

Comments

@uwinx
Copy link

uwinx commented Mar 15, 2020

PyCharm 2019.3 does lookup for module attributes from yarl/__init__.pyi and as Query and QueryVariable are declared there, it assumes they exist in the yarl/__init__.py, but those two type variables are not declared there. So doing: from yarl import Query, QueryVariable is totally legal for PyCharm, but will throw ImportError in runtime.

As Query and QueryVariable sound very much like they're part of API, I think, it will be a rational move to solve this issue.

Naive solutions:

  1. Declare __all__ in .pyi, which didn't work out for me
  2. Add _ prefix to Query and QueryVariable making them "protected members" of interface file.
  3. Declare same types in __init__.py. I don't think this is a good idea.
@asvetlov
Copy link
Member

_ prefix is better, type aliases are not a part or public API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants