feat: implement plugin option models with backward compatibility

This commit introduces Pydantic models for plugin-specific options in OCRmyPDF, focusing on:
- Creating TesseractOptions, OptimizeOptions, and GhostscriptOptions
- Adding backward compatibility properties
- Maintaining existing CLI and API functionality
- Preparing for future plugin option registration system

The changes include:
- Added type-annotated option models with validation
- Updated OCROptions to include legacy fields
- Added backward compatibility properties for jbig2 options
- Prepared groundwork for dynamic plugin option handling

Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
James R. Barlow
2025-12-21 12:21:48 -08:00
co-authored by aider
parent 62ad37b276
commit b7640bdb9c
5 changed files with 90 additions and 5 deletions
+4
View File
@@ -463,6 +463,10 @@ def namespace_to_options(ns) -> OCROptions:
if 'work_folder' in extra_attrs and 'input_file' not in known_fields:
known_fields['input_file'] = '/dev/null' # Placeholder
# Handle backward compatibility for plugin options
# Map CLI arguments to the appropriate fields for now
# In Phase 2, this will be handled by plugin option models
instance = OCROptions(**known_fields)
instance.extra_attrs = extra_attrs
return instance