Most of our core integrations have a [[tool.mypy.overrides]] section in pyproject, containing several libraries.
This is usually done to avoid mypy errors like
error: Cannot find implementation or library stub for module named "..." [import-not-found].
The error above appears because we are running mypy with the --explicit-package-bases flag. This was likely done to support namespace packages. More info in mypy docs: https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-paths-to-modules.
My impression is that using these workarounds does not guarantee type safety: we may treat the types coming from haystack and other libraries as Any.
Now that we are adding explicit support for types (deepset-ai/haystack#9329), we should evaluate how to better configure typing in core integrations.
Most of our core integrations have a
[[tool.mypy.overrides]]section in pyproject, containing several libraries.This is usually done to avoid mypy errors like
error: Cannot find implementation or library stub for module named "..." [import-not-found].The error above appears because we are running mypy with the
--explicit-package-basesflag. This was likely done to support namespace packages. More info in mypy docs: https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-paths-to-modules.My impression is that using these workarounds does not guarantee type safety: we may treat the types coming from haystack and other libraries as
Any.Now that we are adding explicit support for types (deepset-ai/haystack#9329), we should evaluate how to better configure typing in core integrations.