Migrate from PyPDF2 to PyMuPDF - #24
Merged
Merged
Conversation
## Summary - Complete migration from PyPDF2 to PyMuPDF for all PDF processing tools - Add MIT license with third-party license attribution - Add comprehensive migration TODO documentation - Update dependencies and improve resource management ## Changes ### Dependency Updates - Remove PyPDF2 dependency entirely - Update PyMuPDF: 1.25.4 → 1.26.5 - Update Pillow: 11.1.0 → 12.0.0 - Update dify_plugin: 0.1.0-0.2.0 → 0.3.0-0.6.0 ### Tool Improvements All tools migrated with proper resource cleanup and error handling: **pdf_page_counter.py**: - Migrated to PyMuPDF with proper resource cleanup - Removed output_format parameter (now always outputs both text and JSON) - Added dynamic padding for page numbers (supports 100+ page PDFs) - Improved error handling and validation **pdf_single_page_extractor.py**: - Migrated to PyMuPDF's insert_pdf() method - Added proper resource cleanup for doc and output objects - Fixed buffer position reset issue - Enhanced error handling in exception paths **pdf_multi_pages_extractor.py**: - Migrated to PyMuPDF with insert_pdf() for page extraction - Improved resource management with proper cleanup - Fixed buffer handling for PDF output - Enhanced error recovery **pdf_splitter.py**: - Migrated to PyMuPDF for page splitting - Added proper resource cleanup in loops - Improved error handling and memory management - Fixed buffer position reset **pdf_to_png.py**: - Enhanced existing PyMuPDF implementation - Added explicit filetype parameter - Improved resource cleanup with conditional checks - Added cleanup in exception handlers ### Documentation - Added MIT LICENSE with third-party license attribution - Added TODO.md with complete migration checklist - Updated README.md to remove deprecated output_format parameter - Added .difyignore entries for development files ### Configuration - Updated manifest.yaml version: 0.0.3 → 0.0.4 - Updated pdf_page_counter.yaml to remove output_format parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Run ruff linter and formatter to fix code quality issues - Run mdformat to standardize markdown formatting - Add LICENSE section to README with third-party dependency information - Add GitHub Actions CI workflow for automated linting checks Changes: - Fixed unused imports and variables identified by ruff - Formatted all Python files with ruff formatter - Formatted all markdown files with mdformat --number - Added lint.yml workflow: ruff check, ruff format, mdformat - Updated README with MIT license and PyMuPDF AGPL-3.0 notice - Updated .difyignore and .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Complete migration from PyPDF2 to PyMuPDF for improved performance, consistency, and better resource management across all PDF processing tools. Includes code quality improvements, CI automation, and version 1.0.0 release.
Changes
🔧 Dependency Updates
1.25.4→1.26.511.1.0→12.0.00.1.0-0.2.0→0.3.0-0.6.0✨ Tool Improvements
pdf_page_counter.py
output_formatparameter (now always outputs both text and JSON)pdf_single_page_extractor.py
insert_pdf()methodpdf_multi_pages_extractor.py
insert_pdf()for page extractionpdf_splitter.py
pdf_to_png.py
filetypeparameter📝 Documentation
output_formatparameter documentation⚙️ Configuration
0.0.4→1.0.0🎉output_formatparameter🔍 Code Quality
ToolParameterOption,List)🚀 CI/CD
.github/workflows/lint.yml):Test Plan
Breaking Changes
output_formatparameter. Tool now always outputs both text and JSON formats.1.0.0indicating stable release with breaking changes🤖 Generated with Claude Code