Component protocol not correctly recognized by PyCharm anymore
Describe the bug This PR leads to type errors with the PyCharm linter (2024.3.5 Professional Edition).
When using Pipeline.add_component PyCharm flags a typing issue (Expected type 'Component', got 'ChatPromptBuilder' instead).
When I change the component protocol back to the state before the PR it works without issues.
The property getter suggested by @denisw works for original Haystack components but not for custom component (not sure why).
Expected behavior The protocol should be recognized correctly. PyCharm is a major IDE.
Additional context Add any other context about the problem here, like document types / preprocessing steps / settings of reader etc.
To Reproduce Steps to reproduce the behavior
FAQ Check
- [ ] Have you had a look at our new FAQ page?
System:
- OS:
- GPU/CPU:
- Haystack version (commit or version number):
- DocumentStore:
- Reader:
- Retriever:
Seems related to this issue in PyCharm https://youtrack.jetbrains.com/issue/PY-61357/PyCharm-wrongly-flags-attributes-as-bad-implementations-of-Protocol-properties where their linter has issues with type checking against Protocols