marcinbarczynski · GitHub

Describe the bug

In a basic checking mode, pyright reports an error when importing a symbol from a module that is not re-exported using import ... as ... convention. In alembic.util package __init__.py imports symbols from other modules within the package.
I assume the intention was to re-export the imported symbols.

Expected behavior

No error reported by pyright.

To Reproduce

from alembic.util import coerce_resource_to_filename
def fun():
    coerce_resource_to_filename("A")

Error

$ pyright ../demo.py
/path/to/demo.py
  /path/to/demo.py:1:26 - error: "coerce_resource_to_filename" is not exported from module "alembic.util"
    Import from "alembic.util.pyfiles" instead (reportPrivateImportUsage)
1 error, 0 warnings, 0 informations

Versions.

  • OS: Linux
  • Python: 3.11.5
  • pyright: 1.1.339
  • Alembic: 1.13.0

Have a nice day!

Read the original on github.com ↗