Files
LegacyHUB/app/ingestion/docling_extractor.py
Vadim Malanov 1c1dceeee2 fix(ci): restore green backend gate after engine pin
Ruff: declare adapter re-exports via __all__ in docling_extractor
(F401) and sort the engine import block in the adapter test (I001).
Pytest: engine-dependent tests now importorskip the pinned engine —
CI installs light deps only and the engine repo is private, so they
skip visibly there and run in Docker/dev envs with the engine.

Verified: ruff clean; pytest 74 passed + 2 skipped without engine,
80 passed with the pinned engine v0.1.0 installed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 09:45:55 +03:00

32 lines
829 B
Python

"""LegacyHUB adapter for the shared Docling recognition engine."""
from __future__ import annotations
from pathlib import Path
from teamhub_document_recognition_engine import (
ExtractedBlock,
ExtractedFigure,
ExtractedPage,
ExtractedTable,
ExtractionResult,
)
from teamhub_document_recognition_engine import extract as _engine_extract
from app.config import settings
# Re-exported engine models: chunker, table/figure processors and tests import
# them from this adapter instead of depending on the engine package directly.
__all__ = [
"ExtractedBlock",
"ExtractedFigure",
"ExtractedPage",
"ExtractedTable",
"ExtractionResult",
"extract",
]
def extract(pdf_path: Path) -> ExtractionResult:
return _engine_extract(pdf_path, docling_ocr_enabled=settings.docling_ocr_enabled)