Skip to content

mypy failure with --no-implicit-reexport #897

Description

@philpep

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpep 484typing related issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions