Add pluggable comparison engine system with Docxodus support #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a pluggable comparison engine architecture for the python-redlines library, enabling support for multiple document comparison backends. It adds the Docxodus engine (a modern .NET 8.0 fork of Open-Xml-PowerTools) alongside the existing Open-Xml-PowerTools engine, with improved build infrastructure and comprehensive documentation.
Key Changes
Architecture & Core
ComparisonEngineabstract base class andComparisonErrorexception for a pluggable architectureEngineRegistryfor dynamic engine discovery and selection viaget_engine()functionBinaryManagerutility class to handle platform-specific binary extraction and caching for both Windows, Linux, and macOS (x64 and ARM64)Engine Implementations
ComparisonEnginewith improved error handling and backward compatibilitycompare(author, original, modified)interfaceBuild System
--engine,--platform)csproj-docxodus/with Program.cs and redline.csproj for building the Docxodus binarySKIP_BINARY_BUILDenvironment variable is set (useful for development)Project Metadata
pyproject.tomlwith proper description, keywords, and classifiersbuild-engines,build-openxml,build-docxodusDocumentation
__init__.pywith quick start examplesDirectory Structure
dist/openxml-powertools/anddist/docxodus/.gitignorefiles for binary artifactsImplementation Details
run_redline()method andextracted_binaries_pathproperty on XmlPowerToolsEngine for existing codeTesting Considerations
The changes maintain backward compatibility while enabling new functionality. Existing code using
XmlPowerToolsEnginedirectly will continue to work unchanged. New code can use the registry system for more flexible engine selection.