• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

deepset-ai / haystack / 13453333627

21 Feb 2025 08:55AM UTC coverage: 90.155% (-1.0%) from 91.142%
13453333627

push

github

web-flow
perf: Optimize import times (#8878)

* initial experiments

* progress

* draft

* fix header

* fix linting

* lot more lazy inits

* fixes to main init

* linting

* small refinements

* header fix

* release note

* improve consistency

* test: make sure no extra modules are being imported due to `__init__` definitions

* extend release note with an example

* refactoring import test

* updating release notes

* casting .keys() to list

* reverting to list

* Update haystack/__init__.py

Co-authored-by: Julian Risch <julian.risch@deepset.ai>

* fixing ident problem

* better comments

---------

Co-authored-by: David S. Batista <dsbatista@gmail.com>
Co-authored-by: Julian Risch <julian.risch@deepset.ai>

9496 of 10533 relevant lines covered (90.15%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.55
haystack/components/generators/__init__.py
1
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
2
#
3
# SPDX-License-Identifier: Apache-2.0
4

5
import sys
1✔
6
from typing import TYPE_CHECKING
1✔
7

8
from lazy_imports import LazyImporter
1✔
9

10
_import_structure = {
1✔
11
    "openai": ["OpenAIGenerator"],
12
    "azure": ["AzureOpenAIGenerator"],
13
    "hugging_face_local": ["HuggingFaceLocalGenerator"],
14
    "hugging_face_api": ["HuggingFaceAPIGenerator"],
15
    "openai_dalle": ["DALLEImageGenerator"],
16
}
17

18
if TYPE_CHECKING:
1✔
19
    from .azure import AzureOpenAIGenerator
×
20
    from .hugging_face_api import HuggingFaceAPIGenerator
×
21
    from .hugging_face_local import HuggingFaceLocalGenerator
×
22
    from .openai import OpenAIGenerator
×
23
    from .openai_dalle import DALLEImageGenerator
×
24

25
else:
26
    sys.modules[__name__] = LazyImporter(name=__name__, module_file=__file__, import_structure=_import_structure)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc