Coverage for src/local_deep_research/exporters/__init__.py: 83%

12 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-03 23:15 +0000

1"""Document exporters package. 

2 

3This package provides a modular system for exporting research reports 

4to various document formats (PDF, ODT, LaTeX, etc.). 

5 

6Example usage: 

7 from local_deep_research.exporters import ExporterRegistry, ExportOptions 

8 

9 # Get an exporter 

10 exporter = ExporterRegistry.get_exporter("pdf") 

11 

12 # Export content 

13 options = ExportOptions(title="My Research Report") 

14 result = exporter.export(markdown_content, options) 

15 

16 # Use the result - content is available in memory as bytes 

17 # result.content contains the file bytes 

18 # result.filename is the suggested filename 

19 # result.mimetype is the MIME type for HTTP responses 

20 

21Available formats can be queried with: 

22 ExporterRegistry.get_available_formats() 

23""" 

24 

25from loguru import logger 

26 

27from .base import BaseExporter, ExportOptions, ExportResult 

28from .registry import ExporterRegistry 

29 

30# Import all exporters to trigger registration 

31# These imports must come after the base and registry imports 

32from . import latex_exporter # noqa: F401 

33from . import odt_exporter # noqa: F401 

34 

35try: 

36 from . import pdf_exporter # noqa: F401 

37except (ImportError, OSError): 

38 logger.warning( 

39 "PDF exporter could not be loaded — PDF export will be unavailable" 

40 ) 

41 

42from . import quarto_exporter # noqa: F401 

43from . import ris_exporter # noqa: F401 

44 

45__all__ = [ 

46 "BaseExporter", 

47 "ExportOptions", 

48 "ExportResult", 

49 "ExporterRegistry", 

50]