olirice / alembic_utils

An alembic/sqlalchemy extension for migrating sql views, functions, triggers, and policies
https://olirice.github.io/alembic_utils
MIT License
208 stars 43 forks source link

feat: Type info #134

Closed candiduslynx closed 1 month ago

candiduslynx commented 1 month ago

When running mypy against the migrations that are generated using alembic_utils I get the following errors:

migrations/versions/some.py:10: error: Skipping analyzing "alembic_utils.pg_view": module is installed, but missing library stubs or py.typed marker  [import-untyped]
migrations/versions/some.py:10: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
migrations/versions/some.py:238: error: Module has no attribute "create_entity"  [attr-defined]
migrations/versions/some.py:247: error: Module has no attribute "drop_entity"  [attr-defined]

Relevant doc.

Possible resolution would be adding type information

olirice commented 1 month ago

looks reasonable, would you be interested in opening a PR to see if that resolves your issue?

olirice commented 1 month ago

As a backup you could also exclude your migrations/ directory from mypy as migrations tend to be static and don't benefit as much from type safety

candiduslynx commented 1 month ago

looks reasonable, would you be interested in opening a PR to see if that resolves your issue?

Unfortunately I'm really new to Python myself, so I won't be of any real help here.

olirice commented 1 month ago

available in 0.8.4 https://pypi.org/project/alembic-utils/0.8.4/

candiduslynx commented 1 month ago

Thanks!