haystack icon indicating copy to clipboard operation
haystack copied to clipboard

fix: re-export symbols in __init__.py files

Open anakin87 opened this issue 6 months ago • 2 comments

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 ChatPromptBuilder instead of from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder.
  • 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

anakin87 avatar Jun 16 '25 10:06 anakin87

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 Coverage Status
Change from base Build 15679263320: -0.2%
Covered Lines: 11541
Relevant Lines: 12803

💛 - Coveralls

coveralls avatar Jun 16 '25 10:06 coveralls

@anakin87 looks good! Just a few comments.

sjrl avatar Jun 16 '25 11:06 sjrl