Skip to content

pyright 1.1.409 reportPrivateImportUsage on torch.bfloat16 import #11405

@thejcannon

Description

@thejcannon

Describe the bug

Given a file like

from torch import bfloat16

Then:

me@computer $ uv tool run --with pyright==1.1.408 --with torch==2.8.0 --python 3.12 pyright client.py
0 errors, 0 warnings, 0 informations
me@computer $ uv tool run --with pyright==1.1.409 --with torch==2.8.0 --python 3.12 pyright client.py
/home/josh_cannon/client.py
  /home/josh_cannon/client.py:1:19 - error: "bfloat16" is not exported from module "torch"
    Import from "torch._C" instead (reportPrivateImportUsage)

I suspect this is due to #11375, but couldn't verify precisely.

This also may just be a bug in torch (e.g. torch should define a __init__.pyi with all the names in it, a subset of which are in _C/__init__.pyi)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions