Skip to content

Commit b828218

Browse files
committed
chore(extract-python,extract-core): improve optional deps installation
1 parent f128379 commit b828218

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎extract-core/extract_core/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
try:
2222
from .docling_ import DoclingFormatOption, DoclingPipelineConfig
23-
except ImportError:
23+
except ModuleNotFoundError:
2424
DoclingPipelineConfig, DoclingFormatOption = None, None
2525
try:
2626
from .marker_ import MarkerPipelineConfig
27-
except ImportError:
27+
except ModuleNotFoundError:
2828
MarkerPipelineConfig = None
2929

3030

3131
try:
3232
from .miner_u import MinerUBackend, MinerUConfig, MinerUPipelineConfig
33-
except ImportError:
33+
except ModuleNotFoundError:
3434
MinerUBackend, MinerUPipelineConfig, MinerUConfig = None, None, None
3535

3636

‎extract-python/extract_python/__init__.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
import logging
2+
3+
logger = logging.getLogger(__name__)
4+
15
try:
26
from .docling_ import DOCLING_DEFAULT_ARTIFACTS_PATH, DoclingPipeline
3-
except ImportError:
7+
except ModuleNotFoundError:
8+
logger.exception("docling is not available, might be optional...")
49
DOCKING_DEFAULT_ARTIFACTS_PATH, DoclingPipeline = None, None
510

611
try:
712
from .marker_ import MarkerPipeline
8-
except ImportError:
13+
except ModuleNotFoundError:
14+
logger.exception("marker is not available, might be optional...")
915
MarkerPipeline = None
1016

1117

1218
try:
1319
from .miner_u import MinerUPipeline
14-
except ImportError:
20+
except ModuleNotFoundError:
21+
logger.exception("mineru is not available, might be optional...")
1522
MinerUPipeline = None
1623

1724

0 commit comments

Comments
 (0)