fix(upload_trigger): migrate from EOL PyPDF2 to maintained pypdf#121
Open
valter-silva-au wants to merge 1 commit into
Open
fix(upload_trigger): migrate from EOL PyPDF2 to maintained pypdf#121valter-silva-au wants to merge 1 commit into
valter-silva-au wants to merge 1 commit into
Conversation
PyPDF2 was discontinued by py-pdf and merged into the maintained `pypdf` package; PyPDF2==3.0.1 is end-of-life. The sibling generate_embeddings Lambda already uses pypdf==3.17.0, so the upload_trigger path was the only place still pinned to abandoned code. pypdf 3.x is a drop-in successor with an identical API at this version: - requirements.txt: PyPDF2==3.0.1 -> pypdf==3.17.0 (matches sibling) - main.py: `import PyPDF2` -> `from pypdf import PdfReader` - main.py: `PyPDF2.PdfReader(f)` -> `PdfReader(f)` `reader.pages` access is unchanged. Verified the migrated path returns the correct page count against pypdf 3.17.0.
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.
What
Migrate the
upload_triggerLambda from the end-of-lifePyPDF2package to its maintained successor,pypdf.Why
py-pdfdiscontinuedPyPDF2and merged it into the maintainedpypdfpackage —PyPDF2==3.0.1is the final, now-abandoned release. The siblinggenerate_embeddingsLambda already usespypdf(pypdf==3.17.0), soupload_triggerwas the only place in the backend still pinned to discontinued code. This aligns both Lambdas on the same maintained library.Change
pypdf3.x is a drop-in successor with an identical API at this version, so the change is minimal:backend/src/upload_trigger/requirements.txt:PyPDF2==3.0.1→pypdf==3.17.0(matches the sibling Lambda)backend/src/upload_trigger/main.py:import PyPDF2→from pypdf import PdfReaderbackend/src/upload_trigger/main.py:PyPDF2.PdfReader(f)→PdfReader(f)reader.pagesaccess is unchanged. Pinned to3.17.0to matchgenerate_embeddingsas it stands onmain.Verification
grep -r PyPDF2 backend/returns no matches; both Lambdas now resolvepypdfonly.PdfReader(f)→len(reader.pages)) againstpypdf==3.17.0with a real multi-page PDF — the page count is computed correctly.I confirm that this contribution is made under the terms of the Apache-2.0 license of this project.