haystack
haystack copied to clipboard
fix: re-export symbols in __init__.py files
Related Issues
- fixes #9506
Proposed Changes:
- re-export symbols in __init__.py files to make shorter imports work without errors/warning from mypy/Pylance.
- Shorter import example:
from haystack.components.builders import ChatPromptBuilderinstead offrom haystack.components.builders.chat_prompt_builder import ChatPromptBuilder.
- Shorter import example:
- I implemented the solution suggested in the original issue and in Python typing docs
How did you test it?
- CI
- In a fresh virtual environment, I installed Haystack from the current branch. Pylance/mypy errors/warning related to short imports disappeared.
Checklist
- I have read the contributors guidelines and the code of conduct
- I have updated the related issue with new insights and changes
- I added unit tests and updated the docstrings
- I've used one of the conventional commit types for my PR title:
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes. - I documented my code
- I ran pre-commit hooks and fixed any issue
Pull Request Test Coverage Report for Build 15679340982
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- 31 unchanged lines in 6 files lost coverage.
- Overall coverage decreased (-0.2%) to 90.143%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| components/embedders/init.py | 1 | 42.86% |
| components/retrievers/init.py | 1 | 54.55% |
| components/extractors/init.py | 2 | 60.0% |
| components/rankers/init.py | 2 | 46.15% |
| dataclasses/init.py | 12 | 24.0% |
| utils/init.py | 13 | 20.69% |
| <!-- | Total: | 31 |
| Totals | |
|---|---|
| Change from base Build 15679263320: | -0.2% |
| Covered Lines: | 11541 |
| Relevant Lines: | 12803 |
💛 - Coveralls
@anakin87 looks good! Just a few comments.