markitect-main/markitect/proxy/extractors/base.py

44 lines
1.1 KiB
Python
Raw Normal View History

"""
Abstract base class for proxy file extractors.
"""
from abc import ABC, abstractmethod
from pathlib import Path
from markitect.proxy.models import ExtractionResult
class BaseExtractor(ABC):
"""Base class that all proxy extractors must implement."""
name: str = ""
version: str = "1.0"
extensions: tuple = ()
@abstractmethod
def extract(self, source_path: Path) -> ExtractionResult:
"""Extract markdown content from a source file.
Args:
source_path: Path to the source file.
Returns:
ExtractionResult with the extracted markdown content.
"""
@abstractmethod
def check_dependencies(self) -> bool:
"""Check whether all required dependencies are available.
Returns:
True if all dependencies are installed, False otherwise.
"""
def dependency_hint(self) -> str:
"""Human-readable install instructions for missing dependencies.
Returns:
A string like ``pip install markitect[proxy-pdf]``.
"""
return ""