google / pytype

A static type analyzer for Python code
https://google.github.io/pytype
Other
4.78k stars 279 forks source link

Couldn't import pyi for 'tqdm.notebook' [pyi-error] #1838

Open seangies opened 2 weeks ago

seangies commented 2 weeks ago

The following import statement triggers a pyi error in pytype:

from tqdm.notebook import IProgress

To reproduce: python-3.9.15 tqdm==4.67.0 pytype==2024.9.13

Test file is foo.py:

from tqdm.notebook import IProgress

def foo():
    pass

Run pytype on it:

~/src/clean ❯ python3 -m pytype foo.py
Computing dependencies
Analyzing 1 sources with 0 local dependencies
ninja: Entering directory `.pytype'
[1/1] check foo
FAILED: ~/src/clean/.pytype/pyi/foo.pyi 
~/.pyenv/versions/venv-clean/bin/python3 -m pytype.main --imports_info ~/src/clean/.pytype/imports/foo.imports --module-name foo --platform darwin -V 3.9 -o ~/src/clean/.pytype/pyi/foo.pyi --analyze-annotated --nofail --quick ~/src/clean/foo.py
~/src/clean/foo.py:1:1: error: in <module>: Couldn't import pyi for 'tqdm.notebook' [pyi-error]
  Unreplaced NamedType: 'tqdm.std.tqdm', referenced from 'tqdm.notebook'

from tqdm.notebook import IProgress~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from tqdm.notebook import IProgress

For more details, see https://google.github.io/pytype/errors.html#pyi-error
ninja: build stopped: subcommand failed.
Leaving directory '.pytype'