Skip to content

Typeshedding issues with tornado and python typing #813

Closed

Description

Describe the bug

Pyright shows several imports of tornado and typing as "is unknown import symbol", while such classes are present in actual libraries.

Such as:

  x:x - error: "HTTPClientError" is not a known member of module (reportGeneralTypeIssues)
  x:x - error: "_GenericAlias" is unknown import symbol (reportGeneralTypeIssues)
  x:x - error: "_TypedDictMeta" is unknown import symbol (reportGeneralTypeIssues)

At least the HTTPClientError has been in use since tornado version 5.1, and project I'm working on is using 6.0.2. Besides, tornado already has types, so why does it need typeshed?

To Reproduce

  1. create new virtual environemnt, activate it
$ python3 -m venv ./.venv
$ source ./.venv/bin/activate
  1. install tornado to the environment
    $ python3 -m pip install tornado
  2. create new python file, import items listed from above. For example:
from typing import _GenericAlias, _TypedDictMeta
from tornado.httpclient import HTTPClientError
  1. run pyright to file which has imports from previous part.
    $ pyright your_file.py

Expected behavior
Should run without "unknown import symbol"-errors

VS Code extension or command-line
I'm using comand-line tool.
After brief testing using pyright VS Code-extension it makes red squiggly lines under the same imports.

Additional context
#679 (comment)

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

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