8000 FIX: account for deprecations of constant in Pillow 9.1 by tacaswell · Pull Request #22766 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: account for deprecations of constant in Pillow 9.1 #22766

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

Merged
merged 5 commits into from
Apr 4, 2022

Conversation

tacaswell
Copy link
Member

https://pillow.readthedocs.io/en/stable/deprecations.html#constants

Image.None -> Image.Dither.None
Image.ADAPTIVE -> Image.Palette.ADAPTIVE

PR Summary

un-break CI by not triggering warnings from Pilllow

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

palette=Image.ADAPTIVE, colors=num_colors)
# These constants were converted to IntEnums and deprecated in
# Pillow 9.2
dither = (
Copy link
Member Author

Choose a reason for hiding this comment

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

I know this style is odd, but these names a very long and this code is very indented.

I also tried

                dither = (
                    Image.Dither.NONE
                    if hasattr(Image, 'Dither')
                    else Image.NONE
                )

and liked that worse.

also tried doing this in-line in the function call, but that was also (subjectively) worse to my eye.

@tacaswell
Copy link
Member Author

I have also just started seeing these temp file related failures locally (they go away on re-running). I had hoped it was because I was running too many unstable things, seeing if I can track this down...

@tacaswell
Copy link
Member Author
tacaswell commented Apr 1, 2022

I'm also a little confused because the version of Pillow that broke thing is 9.1, but the docs say 9.2.

This was a typo in the pillow docs: python-pillow/Pillow#6171

@tacaswell tacaswell force-pushed the fix_pillow_compat branch from f219f8a to 8b0d527 Compare April 1, 2022 18:15
@tacaswell tacaswell changed the title FIX: account for constant deprecations in Pillow 9.2 FIX: account for constant deprecations in Pillow 9.1 Apr 1, 2022
@QuLogic
Copy link
Member
QuLogic commented Apr 1, 2022

Why pin if the rest is going to fix it?

@tacaswell tacaswell force-pushed the fix_pillow_compat branch from 8b0d527 to e3fea7e Compare April 1, 2022 21:50
@tacaswell
Copy link
Member Author

Why pin if the rest is going to fix it?

because it didn't fix it, some how bumping pillow exposed a leaking temporary directory...

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Apr 1, 2022
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
@oscargus oscargus merged commit 4f5b310 into matplotlib:main Apr 4, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 4, 2022
@tacaswell tacaswell deleted the fix_pillow_compat branch April 4, 2022 15:55
oscargus added a commit that referenced this pull request Apr 4, 2022
…766-on-v3.5.x

Backport PR #22766 on branch v3.5.x (FIX: account for constant deprecations in Pillow 9.1)
@tacaswell
Copy link
Member Author

Re-reading the title of this issue. I just want to be clear this is about the deprecation of constants in Pillow, not a frequent stream of deprecations in Pillow....

@tacaswell tacaswell changed the title FIX: account for constant deprecations in Pillow 9.1 FIX: account for deprecations of constant in Pillow 9.1 Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0