alembic: mypy failure with --no-implicit-reexport
Describe the bug
Using mypy with --no-implicit-reexport (which is part of --strict) generate a failure since alembic 1.7
Expected behavior
No AssertionError
To Reproduce
$ cat << EOF > t.py
import alembic
EOF
$ mypy --no-implicit-reexport t.py
Traceback (most recent call last):
File "[...]/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "[...]/lib/python3.9/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 87, in main
File "mypy/main.py", line 165, in run_build
File "mypy/build.py", line 179, in build
File "mypy/build.py", line 254, in _build
File "mypy/build.py", line 2697, in dispatch
File "mypy/build.py", line 3021, in process_graph
File "mypy/build.py", line 3138, in process_stale_scc
File "mypy/build.py", line 2288, in write_cache
File "mypy/build.py", line 1475, in write_cache
File "mypy/nodes.py", line 313, in serialize
File "mypy/nodes.py", line 3149, in serialize
File "mypy/nodes.py", line 3083, in serialize
AssertionError: Definition of alembic.runtime.migration.EnvironmentContext is unexpectedly incomplete
Versions.
- OS: Debian 11
- Python: 3.9
- Alembic: 1.7.1
- SQLAlchemy: 1.4.23
- mypy: 0.910
Note it might be a mypy bug (since this is an AssertionError), but I think this looks related to some weirdness in alembic typing code.
Thanks!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 16 (12 by maintainers)
I’m not sure if this is relevant to this particular issue, but with
no_implicit_reexportset to false, mypy still complains that: