Skip to content
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

Improve pypdfium2 integration again #1096

Merged
merged 5 commits into from
Oct 12, 2022
Merged

Conversation

mara004
Copy link
Contributor

@mara004 mara004 commented Oct 12, 2022

pypdfium2 now implements automatic closing on garbage collection (since v3.3).
Using documents in a context manager has been deprecated to avoid inadvertent closing in wrong order.

Also removed a type check which, I think, is unnecessary. pypdfium2 already checks the input and raises a TypeError accordingly.

pypdfium2 now implements automatic closing on garbage collection. Using
documents in a context manager has been deprecated to avoid inadvertent
closing in wrong order.

Also removed a type check which I think is unnecessary. pypdfium2
already checks the input and raises a TypeError accordingly.
I personally like to use spaces around parameter equals, though...
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #1096 (8fdce28) into main (3d7c812) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1096      +/-   ##
==========================================
+ Coverage   95.19%   95.21%   +0.01%     
==========================================
  Files         142      142              
  Lines        6018     6017       -1     
==========================================
  Hits         5729     5729              
+ Misses        289      288       -1     
Flag Coverage Δ
unittests 95.21% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
doctr/io/pdf.py 91.66% <100.00%> (-0.65%) ⬇️
doctr/transforms/functional/base.py 95.65% <0.00%> (+1.44%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@felixdittrich92 felixdittrich92 added type: enhancement Improvement module: io Related to doctr.io labels Oct 12, 2022
@felixdittrich92 felixdittrich92 self-assigned this Oct 12, 2022
@felixdittrich92 felixdittrich92 added this to the 0.6.1 milestone Oct 12, 2022
Copy link
Contributor

@felixdittrich92 felixdittrich92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mara004 LGTM 👍

@felixdittrich92
Copy link
Contributor

Could you push an empty commit please to trigger CI again ? :)

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

Could you push an empty commit please to trigger CI again ? :)

Done. I probably shouldn't have skipped CI in the first place, but thought it kind of a waste of energy to re-run all the checks just because of black formatting...

@felixdittrich92
Copy link
Contributor

Could you push an empty commit please to trigger CI again ? :)

Done. I probably shouldn't have skipped CI in the first place, but thought it kind of a waste of energy to re-run all the checks just because of black formatting...

Yeah i totally agree the thing is that @charlesmindee is the only one currently with repo maintainer rights so i can merge it only if the CI pass 😅

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

Sure, I see :)

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

Looks like train-char-classification failed again for unrelated reasons.

@felixdittrich92
Copy link
Contributor

FYI you do not need to change any code if you only want to trigger CI you can use:
git commit --allow-empty

:)

@felixdittrich92
Copy link
Contributor

felixdittrich92 commented Oct 12, 2022

Looks like train-char-classification failed again for unrelated reasons.

That's ok we know the issue and have it on track this job fails everytime currently (not a required check for merge) 👍

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

git commit --allow-empty

Thanks, didn't know that yet!

@felixdittrich92 felixdittrich92 merged commit acb9f64 into mindee:main Oct 12, 2022
@felixdittrich92
Copy link
Contributor

Thanks for the update 🤗

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

Thanks for the quick review/merge! Hope I don't annoy you with the frequent changes 🙃

@mara004 mara004 deleted the pdfium branch October 12, 2022 20:30
@felixdittrich92
Copy link
Contributor

No, I really appreciate that. 👍
We just have to be careful to keep it backwards compatible to avoid problems like the render_to_pil breaking change we have had. 😅

@mara004
Copy link
Contributor Author

mara004 commented Oct 12, 2022

Yeah, in this case the previous code stills work of course, and should continue to do so until pypdfium2 4.0 at least (if that ever happens).
However, the new code now requires a minimum of pypdfium2 3.3 because of the automatic closing thing.

So what matters is basically

  • me not doing backwards incompatible changes within one major version
  • doctr restricting the allowed pypdfium2 versions accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: io Related to doctr.io type: enhancement Improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants