Why
PEP 585 enabled collections in the Python standard library (like list) to be used as generics directly, instead of importing analogous members from the typing module (like typing.List).
When available, the PEP 585 syntax should be used instead of importing members from the typing module, as it's more concise and readable.
What to do
- adopt these type hints in the Haystack Core Integrations codebase
- add the corresponding ruff rule to pyproject.toml to enforce this requirement
- (maybe splitting this work in multiple PRs, but not one for each integration could be better)
Why
PEP 585 enabled collections in the Python standard library (like
list) to be used as generics directly, instead of importing analogous members from the typing module (liketyping.List).When available, the PEP 585 syntax should be used instead of importing members from the typing module, as it's more concise and readable.
What to do