Skip to content

release: prepare v0.8.0 - Dependency Pattern Refactoring#79

Merged
AdemBoukhris457 merged 1 commit intomainfrom
release/v0.8.0
Nov 9, 2025
Merged

release: prepare v0.8.0 - Dependency Pattern Refactoring#79
AdemBoukhris457 merged 1 commit intomainfrom
release/v0.8.0

Conversation

@AdemBoukhris457
Copy link
Owner

🚀 Release v0.8.0

This release introduces a major refactoring of OCR and VLM engine configurations to use a dependency injection pattern. This change improves API clarity, enables engine reuse, and provides better separation of concerns. This is a breaking change release - users will need to update their code to use the new API.

⚠️ Breaking Changes

  • OCR Engine Configuration: Parser classes now require pre-initialized OCR engine instances instead of individual OCR parameters

    • PytesseractOCREngine and PaddleOCREngine must be instantiated separately and passed to parsers
    • Removed individual OCR parameters (ocr_lang, ocr_psm, ocr_oem, paddleocr_*, etc.) from parser constructors
    • Default behavior: If no ocr_engine is provided, PytesseractOCREngine() is used automatically
  • VLM Configuration: Parser classes now require pre-initialized VLM engine instances instead of individual VLM parameters

    • VLMStructuredExtractor must be instantiated separately and passed to parsers
    • Removed individual VLM parameters (use_vlm, vlm_provider, vlm_model, vlm_api_key) from parser constructors
    • Default behavior: If no vlm is provided, VLM features are disabled

✨ Improvements

  • Dependency Injection Pattern: Cleaner API design with explicit engine initialization

    • Engines can be created once and reused across multiple parsers
    • Better error handling - engine initialization errors are caught before parser creation
    • Prevents mixed configurations and improves code maintainability
  • Code Quality: Removed unnecessary comments from codebase for cleaner code

  • Consistent API: Both OCR and VLM engines now follow the same dependency pattern

🔧 Technical Changes

  • Refactored all parser classes:

    • StructuredPDFParser
    • EnhancedPDFParser
    • ChartTablePDFParser
    • StructuredDOCXParser
  • Updated CLI commands to create engine instances before parser initialization

  • Updated all UI components (Gradio apps) to use new engine initialization pattern

  • Enhanced error handling for engine initialization failures

📚 Documentation

  • Updated README with new OCR and VLM engine configuration examples
  • Added comprehensive migration guides in documentation
  • Updated all API reference documentation
  • Updated all usage examples and tutorials
  • Added engine configuration sections in user guides

🔄 Migration Guide

Before (v0.7.1):

parser = StructuredPDFParser(
    ocr_lang="eng",
    ocr_psm=6,
    use_vlm=True,
    vlm_provider="openai",
    vlm_api_key="your-key"
)

After (v0.8.0):

from doctra.engines.ocr.pytesseract import PytesseractOCREngine
from doctra.engines.vlm.service import VLMStructuredExtractor

# Initialize engines
ocr_engine = PytesseractOCREngine(lang="eng", psm=6)
vlm_engine = VLMStructuredExtractor(
    vlm_provider="openai",
    api_key="your-key"
)

# Pass to parser
parser = StructuredPDFParser(
    ocr_engine=ocr_engine,
    vlm=vlm_engine
)

For CLI users:

  • No changes needed - CLI automatically handles engine initialization
  • All existing CLI commands work the same way

For UI users:

  • No changes needed - UI components automatically handle engine initialization
  • All existing UI workflows work the same way

📦 Compatibility

  • Python 3.8+ (unchanged)
  • All existing dependencies maintained
  • No new dependencies added

Related PRs

Breaking Changes:
- OCR and VLM engines now use dependency injection pattern
- Parser classes accept pre-initialized engine instances

Improvements:
- Code cleanup and improved API design
- Enhanced documentation with migration guides
@AdemBoukhris457 AdemBoukhris457 added the release Publishing a new release label Nov 9, 2025
@AdemBoukhris457 AdemBoukhris457 merged commit 95b5979 into main Nov 9, 2025
@AdemBoukhris457 AdemBoukhris457 deleted the release/v0.8.0 branch November 9, 2025 23:39
@AdemBoukhris457 AdemBoukhris457 restored the release/v0.8.0 branch November 16, 2025 08:11
@AdemBoukhris457 AdemBoukhris457 deleted the release/v0.8.0 branch November 16, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Publishing a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant