MAINT: Refactor Fit / Zoom parameters#1437
Conversation
bf95314 to
e0e71b7
Compare
This is a breaking change that needs a major version bump
e0e71b7 to
40cd0e9
Compare
Codecov ReportBase: 94.14% // Head: 94.14% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1437 +/- ##
=======================================
Coverage 94.14% 94.14%
=======================================
Files 30 31 +1
Lines 5445 5480 +35
Branches 1038 1037 -1
=======================================
+ Hits 5126 5159 +33
- Misses 191 193 +2
Partials 128 128
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
@pubpub-zz I would introduce this breaking change before #1371. Then you don't need a breaking change in that PR anymore, right? |
|
@pubpub-zz @MasterOdin What do you think about this proposal? |
|
Is there value in allowing If this breaking change does happen, does that mean all of the various deprecated functions and things will be removed as well? |
Good point. Yes, I would proceed with the deprecations then: https://pypdf2.readthedocs.io/en/latest/dev/deprecations.html#how-pypdf2-deprecates-features
I am also thinking about finishing some non-breaking changes in Then make a cut, make get rid of all of the deprecation warnings / deprecated methods, and move the project to For |
BREAKING CHANGES: - Deprecate features with PyPDF2==3.0.0 (#1489) - Refactor Fit / Zoom parameters (#1437) New Features (ENH): - Add Cloning (#1371) - Allow int for indirect_reference in PdfWriter.get_object (#1490) Documentation (DOC): - How to read PDFs from S3 (#1509) - Make MyST parse all links as simple hyperlinks (#1506) - Changed 'latest' for 'stable' generated docs (#1495) - Adjust deprecation procedure (#1487) Maintenance (MAINT): - Use typing.IO for file streams (#1498) [Full Changelog](2.12.1...3.0.0)
Introduce a new
PyPDF2.generic.Fitclass which captures the type and parameter for how a page should be fit in the viewer (e.g. when clicking on a PDF-internal link).The class has one method for each fit type which allows users to discover the different types via their IDE, e.g.
Fit.xyz(left=123, top=456, zoom=2).Breaking Change
This PR introduces a breaking change that needs a major version bump. Affected are the following methods:
PdfMerger.add_outline_itemusedfit: FitTypeand*args: ZoomArgTypeparametersPdfWriter.add_outline_itemusedfit: FitTypeand*args: ZoomArgTypeparametersAnnotationBuilder.linkusedfit: FitType = "/Fit"andfit_args: Tuple[ZoomArgType, ...] = tuple()instead.Instead of having two arguments, we now have only one. To that argument, an object of the new
Fitclass must be passed.Why *args is problematic
Using the
*argspattern is problematic for two reasons: