-
Notifications
You must be signed in to change notification settings - Fork 102
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
drop use of imghdr #443
base: master
Are you sure you want to change the base?
drop use of imghdr #443
Conversation
imghdr is deprecated and will be removed in python 3.13 (see https://peps.python.org/pep-0594/#imghdr) The relevant code in imghdr is just: ``` def test_jpeg(h, f): """JPEG data with JFIF or Exif markers; and raw JPEG""" if h[6:10] in (b'JFIF', b'Exif'): return 'jpeg' elif h[:4] == b'\xff\xd8\xff\xdb': return 'jpeg' ``` So we transplant it directly
Any chance this could get merged in the near future? |
@Commod0re would you please merge this PR and ship a new release to PyPI? I've confirmed that the implementation here matches |
Python 3.13 was released last week, and the imghdr module has been removed. https://www.python.org/downloads/release/python-3130/. Are there any remaining blockers for this PR? |
We cannot move to Python3.13 because of this blocker. But instead of copy-pasting the code, maybe we can try to use some alternatives proposed in PEP-0594? These are the alternatives proposed there: Hope that the issue will be resolved, either by "hardcoding" the old implementation or replacing with "supported" libraries. |
@dkg @sshishov I’ve been using python-magic for a while, and would recommend that: >>> import magic
>>>
>>> magic.from_buffer(imagebytes, mime=True)
'image/jpeg' so the code in this PR could be changed to if magic.from_buffer(imagebytes, mime=True) == 'image/jpeg':
... Any chance to move this PR forward and support Python 3.13 soon? Also, you may want to consider changing this line Line 46 in 30a7571
to avoid future breakage. |
Hi @jenstroeger, Unfortunately I am on the same boat as you. I am just the consumer/user of this repository and maintainer or contributor at least. Therefore we should find the person who has right access to this repo and ask him for this favor. Best regards, Sergei |
@Commod0re , I can see that you have merged the latest MR to this repo. Could you please help us out here and move this repo to support latest Python please? |
- drop support for python 3.8, which is EOLed - add official support for python 3.13 - ...which sadly requires using a fork of PGPy; see discussion at: - SecurityInnovation/PGPy#462 - SecurityInnovation/PGPy#443 - update zstandard library, addressing #21 - update other libraries: - cryptography - ruff - mypy - remove use of [email protected] from the macos/darwin tooling in the Makefile - include type hints (#20); thank you @tim25651!
- drop support for python 3.8, which is EOLed - add official support for python 3.13 - ...which sadly requires using a fork of PGPy; see discussion at: - SecurityInnovation/PGPy#462 - SecurityInnovation/PGPy#443 - update zstandard library, addressing #21 - update other libraries: - cryptography - ruff - mypy - remove use of [email protected] from the macos/darwin tooling in the Makefile - include type hints (#20); thank you @tim25651! Co-authored-by: Nathan J. Mehl <[email protected]>
@sshishov While we're waiting for this project to start moving forward again, I've made a (hopefully temporary) fork available on pypi that has this PR merged and also fixes the cryptography version requirement: https://pypi.org/project/PGPy13/ |
imghdr is deprecated and will be removed in python 3.13 (see https://peps.python.org/pep-0594/#imghdr)
The relevant code in imghdr is just:
So we transplant it directly