Skip to content

Hide Query, QueryType typevars in .pyi #431

@uwinx

Description

@uwinx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions