dropbox / sqlalchemy-stubs

Mypy plugin and stubs for SQLAlchemy
Apache License 2.0
572 stars 102 forks source link

Generate stub with the right annotations #221

Open sweenu opened 3 years ago

sweenu commented 3 years ago

Hi, I have a small problem, my models and the app using them are in different packages. Mypy detects errors in the package with my models, but does not detect errors when those models are used from the app.

So my first guess is that, for some reason, the plugin does not work in a package different from the one where the models are declared. Therefore, I tried to stubgen the package, but the result is that each column has a type Any instead of the types the plugin infers. So I'm guessing the plugin is not used when stubgening.

What is the right way to do this then?