from typing import Callable
# Works without error message
r1: Callable
from my_local import retry as r1
# pip install funcy
# Throws a no-redef error
r2: Callable
from funcy.flow import retry as r2
Expected Behavior
Same behavior (no error) in both cases.
Actual Behavior
my_local.py:1: error: Skipping analyzing "funcy.decorators": module is installed, but missing library stubs or py.typed marker [import]
my_local.py:5: error: Function is missing a type annotation [no-untyped-def]
bug.py:4: error: Missing type parameters for generic type "Callable" [type-arg]
bug.py:9: error: Missing type parameters for generic type "Callable" [type-arg]
bug.py:10: error: Skipping analyzing "funcy.flow": module is installed, but missing library stubs or py.typed marker [import]
bug.py:10: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
bug.py:10: error: Name "r2" already defined on line 9 [no-redef]
Found 6 errors in 2 files (checked 1 source file)
Your Environment
Mypy version used: mypy 1.2.0 (compiled: yes)
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): none
Bug Report
I can type-annotate untyped imports from a local file, but not from a package (in which case I get a
no-redef
error).To Reproduce
my_local.py
bug.py
Expected Behavior
Same behavior (no error) in both cases.
Actual Behavior
Your Environment
mypy.ini
(and other config files): noneSomewhat related: https://github.com/python/mypy/issues/13914