Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-104773: PEP 594: Remove the imghdr module#104777

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 3 commits intopython:mainfromvstinner:remove_imghdr
May 26, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedMay 23, 2023
edited by github-actionsbot
Loading

  • Remove the Lib/test/imghdrdata/ directory.
  • Copy 5 pictures (gif, png, ppm, pgm, xbm) from removed Lib/test/imghdrdata/ to a new Lib/test/tkinterdata/ directory.

📚 Documentation preview 📚:https://cpython-previews--104777.org.readthedocs.build/

@vstinner
Copy link
MemberAuthor

The Docs CI job fails with:

Could not import extension sphinx.builders.epub3 (exception: No module named 'imghdr')

Oh. It seems like the Sphinx EPUB builder requires the removedimghdr module.

cc@JulienPalard@deronnax

gpshead reacted with thumbs up emoji

@hugovk
Copy link
Member

Sphinx used to depend on imghdr, but no longer does as of Sphinx 6.2.0:

Therefore we'll need to start using Sphinx 6.2.0 for Python 3.13.

cc@AA-Turner@CAM-Gerlach.

@JulienPalard
Copy link
Member

Therefore we'll need to start using Sphinx 6.2.0 for Python 3.13.

@doko42 would it be managable from a Debian packaging point of view?

Do we have some contacts with other distribs?

I remember the last bump ofneeds_sphinx raised a lot of concerns.

@hugovk
Copy link
Member

@encukou Is requiring Sphinx 6.2.0 for Python 3.13 okay for Red Hat?

@hugovkhugovk self-requested a reviewMay 23, 2023 09:44
Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Avoid new Sphinx warnings:

diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rstindex 7a479c6e56..9b33155c5a 100644--- a/Doc/whatsnew/3.11.rst+++ b/Doc/whatsnew/3.11.rst@@ -1735,7 +1735,7 @@ Modules   +---------------------+---------------------+---------------------+---------------------+---------------------+   | :mod:`audioop`      | :mod:`crypt`        | :mod:`nis`          | :mod:`sndhdr`       | :mod:`uu`           |   +---------------------+---------------------+---------------------+---------------------+---------------------+-  | :mod:`cgi`          | :mod:`imghdr`       | :mod:`nntplib`      | :mod:`spwd`         | :mod:`xdrlib`       |+  | :mod:`cgi`          | :mod:`!imghdr`      | :mod:`nntplib`      | :mod:`spwd`         | :mod:`xdrlib`       |   +---------------------+---------------------+---------------------+---------------------+---------------------+   | :mod:`cgitb`        | :mod:`mailcap`      | :mod:`ossaudiodev`  | :mod:`sunau`        |                     |   +---------------------+---------------------+---------------------+---------------------+---------------------+diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rstindex 14b6425cea..d13036f6fd 100644--- a/Doc/whatsnew/3.5.rst+++ b/Doc/whatsnew/3.5.rst@@ -1252,7 +1252,7 @@ Oberkirch in :issue:`21800`.) imghdr -------The :func:`~imghdr.what` function now recognizes the+The :func:`!imghdr.what` function now recognizes the `OpenEXR <https://www.openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format

@@ -809,7 +809,7 @@ Modules (see :pep:`594`):
* :mod:`cgitb`
* :mod:`chunk`
* :mod:`crypt`
*:mod:`imghdr`
*``imghdr``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
*``imghdr``
*:mod:`!imghdr`

`filetype <https://pypi.org/project/filetype/>`_,
`puremagic <https://pypi.org/project/puremagic/>`_,
or `python-magic <https://pypi.org/project/python-magic/>`_ instead.
(Contributed by Victor Stinner in :gh:`104773`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Reference the PEP.

Remove the ``imghdr`` module, deprecated in Python 3.11: use the projects
`filetype <https://pypi.org/project/filetype/>`_, `puremagic
<https://pypi.org/project/puremagic/>`_, or `python-magic
<https://pypi.org/project/python-magic/>`_ instead. Patch by Victor Stinner.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Reference the PEP.

@encukou
Copy link
Member

Is requiring Sphinx 6.2.0 for Python 3.13 okay for Red Hat?

Yes. It's OK for Fedora. (And RHEL will follow Fedora after some time.)

@AA-Turner
Copy link
Member

AA-Turner commentedMay 23, 2023
edited
Loading

Avoid new Sphinx warnings:

diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rstindex 14b6425cea..d13036f6fd 100644--- a/Doc/whatsnew/3.5.rst+++ b/Doc/whatsnew/3.5.rst@@ -1252,7 +1252,7 @@ Oberkirch in :issue:`21800`.) imghdr -------The :func:`~imghdr.what` function now recognizes the+The :func:`!imghdr.what` function now recognizes the...

We should likely prefer:func:`~!imghdr.what` to keep the rendered HTML showing onlywhat.

A

@@ -102,6 +102,11 @@ Deprecated
Removed
=======

* Remove the ``imghdr`` module, deprecated in Python 3.11: use the projects
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
* Remove the``imghdr`` module, deprecated in Python 3.11: use the projects
* Remove the:mod:`!imghdr` module, deprecated in Python 3.11: use the projects

@@ -0,0 +1,4 @@
Remove the ``imghdr`` module, deprecated in Python 3.11: use the projects
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Remove the``imghdr`` module, deprecated in Python 3.11: use the projects
Remove the:mod:`!imghdr` module, deprecated in Python 3.11: use the projects

@AA-Turner
Copy link
Member

OpenSUSEis using Sphinx 7 for Python 3.12 builds

Debian and Ubuntu are the only remaining distributions from thelist we checked last time.

A

@vstinner
Copy link
MemberAuthor

I created issue#104818 "Require Sphinx 6.2 to build Python 3.13 documentation". I propose to discuss updating Sphinx (or not) there.

hugovk reacted with thumbs up emoji

@vstinnervstinner marked this pull request as draftMay 24, 2023 12:56
@vstinnervstinner changed the titlegh-104773: PEP 594: Remove the imghdr moduleWIP (blocked by Sphinx): gh-104773: PEP 594: Remove the imghdr moduleMay 24, 2023
@vstinner
Copy link
MemberAuthor

I rebased the PR on the main branch.

@vstinnervstinner changed the titleWIP (blocked by Sphinx): gh-104773: PEP 594: Remove the imghdr modulegh-104773: PEP 594: Remove the imghdr moduleMay 26, 2023
@vstinnervstinner marked this pull request as ready for reviewMay 26, 2023 12:56
* Remove the Lib/test/imghdrdata/ directory.* Copy 5 pictures (gif, png, ppm, pgm, xbm) from removed  Lib/test/imghdrdata/ to a new Lib/test/tkinterdata/ directory.
* Update Sphinx from 4.5 to 6.2 in Doc/requirements.txt.
@vstinnervstinnerenabled auto-merge (squash)May 26, 2023 13:14
Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good, we can use Sphinx 6.2 for the "normal" docs build and for doctest (both userequirements.txt), and still support 3.2 inDoc/requirements-oldest-sphinx.txt.

@vstinner
Copy link
MemberAuthor

Looks good, we can use Sphinx 6.2 for the "normal" docs build and for doctest (both use requirements.txt), and still support 3.2 in Doc/requirements-oldest-sphinx.txt.

Right. I only upgraded Sphinx in the GHA "Doctest" job. It seems like increasing the minimum Sphinx version to build the documentation is notstrictly required to remove the imghdr module.

I prefer to decorelate the imghdr removal and increase the minimum Sphinx version tobuild the Python documentation. So far, still supporting Sphinx 3.2 makes it possible to build Python 3.13 documentation on Debian Stable:#104818 (comment)

hugovk reacted with rocket emoji

@vstinnervstinner merged commite399f46 intopython:mainMay 26, 2023
@vstinnervstinner deleted the remove_imghdr branchMay 26, 2023 14:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AA-TurnerAA-TurnerAA-Turner left review comments

@hugovkhugovkhugovk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@vstinner@hugovk@JulienPalard@encukou@AA-Turner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp