amol- / depot

Toolkit for storing files and attachments in web applications
MIT License
161 stars 41 forks source link

Add support for Pillow 10 #84

Closed tjni closed 8 months ago

tjni commented 1 year ago

Image.ANTIALIAS was replaced by Image.Resampling.LANCZOS. However, the Resampling class is not available in Pillow < 9.1.0, so we need to stub it. Since we would like to support Python 2, it cannot be an IntEnum.

Note: I wasn't able to set up Python 2 on my system to test.

Resolves #75.

amol- commented 1 year ago

DEPOT has been supporting PY2 for historical reasons, and mostly because it was for free. But if Python2 is a blocker to smaller or better implementation we can definitely drop support for it in 0.11. The number of PY2 installs has practically dropped to 0 since June ( https://pypistats.org/packages/filedepot )

tjni commented 1 year ago

Thank you for reviewing this!

For this implementation, there is no cost to supporting Python 2. The only difference is that upstream uses an IntEnum and we need to do with a simple class with integer constants. The only problem was I couldn't actually test my work on Python 2. I don't mind trying to support it still with this PR if CI finds something.

Updating the minimum Pillow dependency to 9.1.0 would simplify the implementation, since we would not need the compat layer anymore; that will only support Python >= 3.7, however.

tjni commented 1 year ago

pypistats.org is really cool, by the way!