From 500d0239e0bc6bafe4f2866bb207260e04fd01ad Mon Sep 17 00:00:00 2001 From: KaifAhmad1 Date: Wed, 18 Mar 2026 00:01:10 +0530 Subject: [PATCH] fix: make python-pptx import lazy in pptx_parser to fix CI collection error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- semantica/parse/pptx_parser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/semantica/parse/pptx_parser.py b/semantica/parse/pptx_parser.py index cd30114c..f88037de 100644 --- a/semantica/parse/pptx_parser.py +++ b/semantica/parse/pptx_parser.py @@ -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