-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy failure with --no-implicit-reexport #897
Comments
Hi, Thanks for reporting. I'm not sure what we should change. Running it without |
Yes, running mypy without Seems when |
A workaround for mypy config might be:
|
IMO mypy devs should look at this. maybe @bryanforbes has insight |
I'm not sure if this is relevant to this particular issue, but with
|
this is explicetly skipped by the stub generator here https://github.com/sqlalchemy/alembic/blob/master/tools/write_pyi.py#L22 since it has no documentation. I guess I can try fiddle with it to see if that's the problem. |
the issue seems to be in caused by the presence of context.pyi, and in particular it seems a circular import error. To reproduce the error it's sufficient having as # context.pyi
from .migration import MigrationContext I think this is a mypy bug |
that import seems wrong, it should come from runtime to avoid the "import *" |
im not really able to trigger the crash at the moment. if you still are, can you try this: diff --git a/alembic/context.pyi b/alembic/context.pyi
index d789a22..5b9dd70 100644
--- a/alembic/context.pyi
+++ b/alembic/context.pyi
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from sqlalchemy.engine.base import Connection
from sqlalchemy.sql.schema import MetaData
- from .migration import MigrationContext
+ from .runtime.migration import MigrationContext
from .runtime.migration import _ProxyTransaction
### end imports ###
|
Mike Bayer has proposed a fix for this issue in the master branch: use in-package imports https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/3077 |
You need to test a file that imports alembic. This: # file.py
import alembic is enough. Then run |
that change does fixes it. Still there is a bug in mypy |
heres the output when i do that:
I have no idea why i am seeing all that or what those errors are |
that's some of the strict mode of mypy. with |
Note no assertion error though. The other day I think this did reproduce for me so I don't know what changed |
yes, I could reproduce the mypy assertion error before this patch. with the patch is seems ok |
Describe the bug
Using mypy with
--no-implicit-reexport
(which is part of--strict
) generate a failure since alembic 1.7Expected behavior
No AssertionError
To Reproduce
Versions.
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!
The text was updated successfully, but these errors were encountered: