-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from PyPDF2 to pypdf #199
Comments
Yes, of course, thank you for letting me know. Let's leave this open until I migrated, or in case I have a question ;-) |
Hey! Is there an update to this? |
Hm, I was not considering it urgent. I am interested to have packages in the linux distros for pypdf but these are still mostly on pyPDF2 as it seems. My favorite distro openSUSE does not seem to have a pypdf package yet at all. Is there a way to use pypdf and pyPDF2 alternatively - somehow with a fallback to pyPDF2 if pypdf was not found? I'd appreciate a bit of advise since I am not sooo deep in python. |
try:
from pypdf import PdfReader, PdfWriter # or whatever you need
except ImportError:
# use the PyPDF2 package if the pypdf package is not present
from PyPDF2 import PdfReader, PdfWriter # or whatever you need |
Thanks, I now tried that. Unfortunately, it does not seem to be that easy: I get a lot of deprecations such as:
It seems to me that this requires a complete rewrite of the scripts with little chance to use one-for-both, or do I miss someting? |
see branch use_pypdf |
All changes are naming changes and should be easy to apply. You can write code that works with PyPDF2>=2.x and pypdf>=3.0.0 - you just need to have a fallback for the import. But yes, you might need a lot of tiny changes. |
Even I have the same problem. After the recent deprecation of pypdf we are unable to read it using PHP. If any one facing the same problem please help us to resolve. |
I'm the maintainer of pypdf and PyPDF2.
In 2022, I've decided to move the projects back together. Now development continues at
pypdf
(all lowercase). PyPDF2 will not receive any updates or bugfixes.pypdf==3.1.0
is essentially the same asPyPDF2==3.0.0
. However, I've noticed that you are probably only compatible withPyPDF2<2.0.0
(or <3.0.0, depending if you would accept deprecation warnings). The migration is mostly renamings, e.g. (PdfFileReader
->PdfReader
, and using snake_case instead of camelCase for methods). See https://pypdf.readthedocs.io/en/latest/user/migration-1-to-2.htmlAre you open to make the move?
The text was updated successfully, but these errors were encountered: