mypy
mypy copied to clipboard
MyPy doesn't understand types-boto 2.49.18.20240205 correctly and fails previously-working code
Bug Report
I can't import stuff out of un-stubbed parts of the stubbed boto module anymore as of the new release of the stubs.
Also, changing the installed stub version without clearing out the MyPy cache produces inconsistent behavior; whether the program typechecks can depend on whether I tried to typecheck it when I had a different version of the stubs installed.
I reported this against the stubs in https://github.com/python/typeshed/issues/11381 but they think MyPy is the problem.
To Reproduce
rm -Rf venv2 .mypy_cache test.py
python3.11 -m virtualenv venv2
. venv2/bin/activate
pip install --upgrade types-boto==2.49.18.20240205 boto==2.49.0 mypy==1.8.0
cat <<'EOF' >test.py
from boto.iam.connection import IAMConnection
EOF
mypy --strict test.py
Expected Behavior
This should typecheck, as it did with types-boto==2.49.18.9.
Actual Behavior
test.py:1: error: Library stubs not installed for "boto.iam.connection" [import-untyped]
test.py:1: note: Hint: "python3 -m pip install types-boto"
test.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.8.0
- Mypy command-line flags:
--strict - Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.11