-
Notifications
You must be signed in to change notification settings - Fork 283
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
For Python 3.13: A drop-in replacement for imghdr.what()
#326
Conversation
@@ -15,6 +15,7 @@ | |||
>>> | |||
|
|||
""" | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup.py currently allows python 2.7 and 3.5+, where this will fail I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 2 died 1,603 days ago on 1/1/2020. Continuing to support it these daze only slows development.
It is probably high time to say that for Python 2.7 v0.4.27
is the last release.
Given that the GitHub Actions only test supported versions of Python how do we prove that legacy Python still works?
https://packaging.python.org/en/latest/discussions/setup-py-deprecated
cca7693
to
a21810c
Compare
Closing in favor of |
The Python 3.13 release notes mention
python-magic
as one of the alternatives forimghdr
which was removed from the Standard Library.Given the discussion in #317, it might be quite helpful to have a drop-in replacement for
imghdr.what()
. It would provide a smooth transition to Py3.13 if developers could confidently replace all instances ofimghdr.what()
withmagic.what()
-- same args, same results.Current pytest results:
45 passed in 0.05s
test_what_from_file
is 2 testsztest_what_from_file_none
is 0 test -- disabled with the leadingz
test_what_from_string
is 10 teststest_what_from_string_py311
is 2 testsimghdr
only on Python < 3.11test_what_from_string_todo
is 31 tests -- Lots of work to do!magic
Usage:
imghdr
documentation: https://docs.python.org/3.12/library/imghdr.htmlimghdr
source code: https://github.com/python/cpython/blob/3.12/Lib/imghdr.py