From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Hanna Reitz" <hreitz@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
qemu-block@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
qemu-rust@nongnu.org,
"Maksim Davydov" <davydov-max@yandex-team.ru>,
"Cleber Rosa" <crosa@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>
Subject: Re: [PATCH 5/8] python: convert remaining deprecated type hints for 3.9+
Date: Tue, 20 May 2025 11:31:03 +0200 [thread overview]
Message-ID: <87r00jaaso.fsf@pond.sub.org> (raw)
In-Reply-To: <20250519182153.3835722-6-jsnow@redhat.com> (John Snow's message of "Mon, 19 May 2025 14:21:49 -0400")
John Snow <jsnow@redhat.com> writes:
> In this patch, we don't have a builtin type to use for a type hint, but
> we do have collections.abc and other standard library types. Replace
> deprecated type hints with their standard library equivalents:
>
> typing.Awaitable => collections.abc.Awaitable
> typing.AbstractSet => collections.abc.AbstractSet
> typing.AsyncIterator => collections.abc.AsyncIterator
> typing.Callable => collections.abc.Callable
> typing.Coroutine => collections.abc.Coroutine
> typing.Deque => collections.deque
> typing.Generator => collections.abc.Generator
> typing.Iterable => collections.abc.Iterable
> typing.Iterator => collections.abc.Iterator
> typing.Mapping => collections.abc.Mapping
> typing.Match => re.Match
> typing.MutableMapping => collections.abc.MutableMapping
> typing.Sequence => collections.abc.Sequence
> typing.ValuesView => collections.abc.ValuesView
>
> The primary benefit of this is, of course, that the standard type can
> now be used directly as the type hint. In general, this means far fewer
> imports from `typing`. The reason we *have* to do this is because the
> old type hints have been deprecated and will be dropped from a Python
> release in the future, so I am just getting ahead of it before it causes
> a problem.
>
> (Granted, yes, in practice this just means we're usually importing from
> collections.abc instead of typing, but... ah well. What are you gonna
> do.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>
I'd expect to catch mistakes in the manual parts. I gave scripts/qapi/
an eye-over anyway, and it looks good to me.
Acked-by: Markus Armbruster <armbru@redhat.com>
Typing imports left at the end of the series:
*
Any
BinaryIO
Generic
IO
Literal
NamedTuple
NewType
NoReturn
Optional
Protocol
TYPE_CHECKING
TextIO
TypeVar
Union
cast
The * are in scripts/codeconverter/. You might want to double-check
nothing deprecated hides behind the *.
The others are all still good, I presume.
next prev parent reply other threads:[~2025-05-20 9:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 18:21 [PATCH 0/8] Python: Fix 'make check-dev' and modernize to 3.9+ John Snow
2025-05-19 18:21 ` [PATCH 1/8] python: convert packages to PEP517/pyproject.toml John Snow
2025-05-19 18:21 ` [PATCH 2/8] python: update pylint ignores John Snow
2025-05-20 7:41 ` Markus Armbruster
2025-05-22 19:10 ` John Snow
2025-05-19 18:21 ` [PATCH 3/8] python: sync changes from external qemu.qmp package John Snow
2025-05-19 18:21 ` [PATCH 4/8] python: use 3.9+ builtin type hints John Snow
2025-05-20 9:26 ` Markus Armbruster
2025-05-22 19:11 ` John Snow
2025-05-19 18:21 ` [PATCH 5/8] python: convert remaining deprecated type hints for 3.9+ John Snow
2025-05-20 9:31 ` Markus Armbruster [this message]
2025-05-22 19:13 ` John Snow
2025-05-19 18:21 ` [PATCH 6/8] python: clean up requirements " John Snow
2025-05-19 18:21 ` [PATCH 7/8] python: update mkvenv to type-check under different python versions John Snow
2025-05-19 18:21 ` [PATCH 8/8] python: remove version restriction for mypy John Snow
2025-05-20 7:53 ` [PATCH 0/8] Python: Fix 'make check-dev' and modernize to 3.9+ Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r00jaaso.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=anisinha@redhat.com \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=davydov-max@yandex-team.ru \
--cc=eduardo@habkost.net \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.