fix: make python-pptx import lazy in pptx_parser to fix CI collection error

python-pptx is not in [dev] extras so it's absent in CI, causing
ModuleNotFoundError during test collection via parse/__init__.py.
Moved import inside the parse method with a clear install hint.

This is the last known bare top-level optional import — sqlalchemy
(db_ingestor.py) and pdfplumber (pdf_parser.py) were fixed in prior commits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
KaifAhmad1
2026-03-18 00:01:10 +05:30
co-authored by Claude Sonnet 4.6
parent e18e6d1a00
commit 500d0239e0
+7 -2
View File
@@ -32,8 +32,6 @@ from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from pptx import Presentation
from ..utils.exceptions import ProcessingError, ValidationError
from ..utils.logging import get_logger
from ..utils.progress_tracker import get_progress_tracker
@@ -97,6 +95,13 @@ class PPTXParser:
raise ValidationError(f"File is not a PPTX: {file_path}")
try:
try:
from pptx import Presentation
except ImportError:
raise ProcessingError(
"python-pptx is required for PPTX parsing. "
"Install with: pip install python-pptx"
)
prs = Presentation(str(file_path))
# Extract metadata