Skip to content
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

Typing #4

Open
fjmacagno opened this issue Jun 3, 2024 · 4 comments
Open

Typing #4

fjmacagno opened this issue Jun 3, 2024 · 4 comments

Comments

@fjmacagno
Copy link

Any chance this library could be typed for use with mypy?

@chadj2
Copy link
Collaborator

chadj2 commented Jun 4, 2024

Most of the arguments and return values are typed. Can you give an example?

@fjmacagno
Copy link
Author

I think that the "typed" flag is needed for mypy to recognize this; i have to include an ignore comment when using these classes and mypy:

from kinetica_provider.hooks.sql import KineticaSqlHook  # type: ignore[import-untyped]

otherwise, i get errors like

error: Skipping analyzing "kinetica_provider.operator.sql": module is installed, but missing library stubs or py.typed marker  [import-untyped]

@chadj2
Copy link
Collaborator

chadj2 commented Jun 6, 2024

The mypy package generates this warning if a library is missing a stub file. We don't add this file automatically and most 3rd party libraries don't either. Are you seeing other libraries in airflow that distribute the file?

@fjmacagno
Copy link
Author

We use mypy with most of Airflow without issue; you shouldnt need to add a stub file since you are actually typing everything, you just need to add a "py.typed marker" at your package root.

Per https://typing.readthedocs.io/en/latest/spec/distributing.html#packaging-typed-libraries:
"Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing. This marker applies recursively: if a top-level package includes it, all its sub-packages MUST support type checking as well."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants