community icon indicating copy to clipboard operation
community copied to clipboard

`imghdr` is deprecated and slated for removal in Python 3.13

Open misl6 opened this issue 2 years ago • 10 comments
trafficstars

We currently make use of the imghdr module to guess the filetype with our ImageLoader.

See: https://peps.python.org/pep-0594/#imghdr

misl6 avatar Jun 24 '23 09:06 misl6

Is this issue up for grab? Id like to contribute to this!

bharathan06 avatar Sep 20 '23 15:09 bharathan06

Is this issue up for grab? Id like to contribute to this!

Yes. Is still available. (And I now assigned it to you)

Thank you!

misl6 avatar Sep 20 '23 15:09 misl6

Thank you so much! id like to contribute with another person. It would be great if you could assign it to them too!

Their github link : https://github.com/vsh9

bharathan06 avatar Sep 22 '23 10:09 bharathan06

@bharathan06 I don't think this issue needs two people to solve :thinking:, imghdr is only used to find the extension of the image file, see https://github.com/kivy/kivy/blob/ca1b918c656f23e401707388f25f4a63d9b8ae7d/kivy/core/image/init.py#L452-L461

I propose using filetype as it supports a lot of file types

p0lygun avatar Sep 22 '23 22:09 p0lygun

I propose using filetype as it supports a lot of file types

I think it's better to use magic number to detect a subset of the fileformat ( same method used by imghdr )

baseplate-admin avatar Sep 23 '23 11:09 baseplate-admin

I propose using filetype as it supports a lot of file types

I think it's better to use magic number to detect a subset of the fileformat ( same method used by imghdr )

from filetype docs

Small and dependency-free Python package to infer file type and MIME type checking the magic numbers signature of a file or buffer.

p0lygun avatar Sep 23 '23 22:09 p0lygun

@bharathan06: Just checking in. How did you go with this?

Julian-O avatar Nov 15 '23 13:11 Julian-O

I'm considering @bharathan06 not available anymore to take care of it, the issue is now in 3.0.0 roadmap and free to pick.

misl6 avatar Jan 20 '24 13:01 misl6

@misl6 i want to take on it.

kengoon avatar Jan 20 '24 14:01 kengoon

That's something lovely to hear @kengoon !

Assigned the issue. Please bear in mind that we're in 3.0.0, so don't be afraid to do any refactoring / cleanup if needed.

misl6 avatar Jan 20 '24 14:01 misl6