You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The imghdr module is deprecated as of Python 3.11, and will be removed in Python 3.13. The deprecation notice is here: https://docs.python.org/3/library/imghdr.html but the PEP referenced as featuring details and alternatives has only details, no specific alternative.
We'll need to find an alternative to imghdr by the time we move to 3.13, and when we do we can remove the linter exception introduced into bookwyrm/connectors/abstract_connector.py with PR #3303 as part of the Python 3.11 upgrade.
Both places in the code where this functionality is used (that I could find), the purpose is to generate a random filename with an extension that matches the encoding of the image:
PEP 594 was updated to include recommendations to replace imghdr.
puremagic looks like it should be a suitable replacement.
get_image already reads the entire file, so overhead compared to imghdr should be minimal (puremagic may try to examine a few more kilobytes than imghdr's 32).
Describe the bug
The imghdr module is deprecated as of Python 3.11, and will be removed in Python 3.13. The deprecation notice is here: https://docs.python.org/3/library/imghdr.html but the PEP referenced as featuring details and alternatives has only details, no specific alternative.
We'll need to find an alternative to imghdr by the time we move to 3.13, and when we do we can remove the linter exception introduced into bookwyrm/connectors/abstract_connector.py with PR #3303 as part of the Python 3.11 upgrade.
To Reproduce
See https://docs.python.org/3/library/imghdr.html and https://peps.python.org/pep-0594/#imghdr for details of the deprecation
Expected behavior
We should find a replacement! <3
Screenshots
N/A
Instance
All
Additional context
N/A
The text was updated successfully, but these errors were encountered: