DEP: Class, variable, and module names#867
Conversation
|
This is a preparation for #859 |
Codecov Report
@@ Coverage Diff @@
## main #867 +/- ##
==========================================
- Coverage 82.46% 77.19% -5.28%
==========================================
Files 16 17 +1
Lines 3776 4328 +552
Branches 802 819 +17
==========================================
+ Hits 3114 3341 +227
- Misses 495 812 +317
- Partials 167 175 +8
Continue to review full report at Codecov.
|
Core classes: * PdfFileReader➔ PdfReader * PdfFileWriter➔ PdfWriter * PdfFileMerger➔ PdfMerger
|
@MartinThoma, May I ask you a question : I do agree that the new names may be more appropriate and in accordance with snake case style, but what not leave the old style with the warning in the future : there will no drawbacks for PyPDF2 development keeping them to keep backward compatibility with the warning and a very limited support |
I'm currently wondering if I really want to do this style change at all 😄 There are so many tiny places ... that is way more work than I expected (mainly due to the fact that I need to add the deprecation warnings). Yes, I was also thinking to keep the parts with the warnings for a while - not measured in PyPDF2 versions, but in calendar time. For example, for a year after the 2.0.0 version is on PyPI. However, I did have a look at a a lot of StackOverflow questions tagged with PyPDF2. Most people seem to use only very basic features of PyPDF2 and not go into more "internal" topics. The most common use-cases seem to be: (1) Text Extraction (2) simple merges without transformations (3) extracting images (4) getting the number of pages of a document. Hence I would not expect too many hickups / breaking things a lot. But there might be a lot hidden that I'm not aware of. I want to drop the deprecation warnings eventually as this clutters the code-base, but I also don't want to break existing code. I'm 90% decided by now that I keep the old names for ~1 year after the 2.0.0 release. What do you think about this idea? |
|
@pubpub-zz Looking at |
I've started this work previously to match pylint and it has been a hudge job not finish.
What About using @MasterOdin's proposal (#684 (comment)) to provide both functions names but encoding the snake case style? warning can still be introduced there. Also I do like your idea to about PendingDeprecationWarning,but I've just discovered that this warning is nearly all the time not reported. perhaps we should use our our warning and provide a function set the warning filters to show/hide them |
agreed |
You seem to recode manually the alternative names for both. The proposal was to do this 'conversion' at the flight and by code. |
I agree my idea is not good. |
Yes, I was. How would you do it differently? (I'll read master odins comment again tomorrow to see what I missed :-)) |
Deprecation Announcements: The following will be deprecated with PyPDF2 2.0.0:
warndestandoverwriteWarningswill be removed. The new default behavior isoverwriteWarnings=Falseandwarndest=NoneoverwriteWarningswill be removed. The new default behavior isoverwriteWarnings=False.PyPDF2.merger.OutlinesObjectwill be removed without replacement.PyPDF2.pdf: Thepdfmodule will be removed. Import directly fromPyPDF2instead.PyPDF2.utils: Theutilsmodule will become private.Core class renames