[PATCH v2] binman: Fix typing for python >= 3.5
Tom Rini
trini at konsulko.com
Mon Jul 14 16:29:20 CEST 2025
On Mon, Jul 14, 2025 at 08:56:57AM -0500, Bryan Brattlof wrote:
> On July 14, 2025 thus sayeth Yannic Moog:
> > Am Montag, dem 14.07.2025 um 07:02 -0500 schrieb Bryan Brattlof:
> > > On July 14, 2025 thus sayeth Yannic Moog:
> > > > To make it work with python 3.5 and 3.6, need type hints from the
> > > > typing module.
> > > >
> > > > Reported-by: Tim Harvey <tharvey at gateworks.com>
> > > > Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged
> > > > image")
> > > > Signed-off-by: Yannic Moog <y.moog at phytec.de>
> > > > ---
> > > > Changes in v2:
> > > > - drop newline changes
> > > > - Link to v1:
> > > > https://lore.kernel.org/r/20250711-binman-typing-fix-v1-1-66ab075015ac@phytec.de
> > > > ---
> > > > tools/binman/etype/cbfs.py | 3 ++-
> > > > tools/binman/etype/mkimage.py | 3 ++-
> > > > tools/binman/etype/section.py | 3 ++-
> > > > 3 files changed, 6 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py
> > > > index
> > > > 5879f377231bf94697bea97c3cfc3a2515665b8f..c5e77f3a0df22ff768aa7254e4dd9ecbe6
> > > > f81684 100644
> > > > --- a/tools/binman/etype/cbfs.py
> > > > +++ b/tools/binman/etype/cbfs.py
> > > > @@ -6,6 +6,7 @@
> > > > #
> > > >
> > > > from collections import OrderedDict
> > > > +from typing import Dict
> > >
> > > It's been a while from my Python days so I'm still trying to understand
> > > what's going on, but my understanding is the 'typing' module is
> > > considered deprecated after Python 3.9 with PEP 589[0]
> >
> > That is correct. Afaik it is supposed to be removed with 3.14. (Source: Fluent
> > Python 2nd Edition).
> > Python 3.6 (and 3.5) does not have access to __futures__.annotations, that is
> > why I asked if we strive for python >= 3.5 support or >= 3.7.
> >
> > So it seems to me there are two paths:
> >
> > - remove type annotations again.
> > - when this typing module gets removed, migrate and require python >= 3.7
> >
> > What do you think is the best course of action?
> >
>
> Grepping around some more it looks like mbedtls is still using the
> typing module so it's probably fine for now. Though I think 3.14 will
> be available by October this year and just in time for this next
> release :/
>
> Going off Python's version status page[0] it looks like we're safe to
> move the minimum requirement to 3.6 or 3.7. Python 3.5 isn't even
> listed as end-of-life anymore.
>
> Debian's oldstable (bullseye) seems to be using 3.9[1]
> Ubuntu's 22.04 (Jammy) seems to use 3.10[2]
> Yocto's Dunfell is using 3.8[3]
>
> I seem remember Rocky 8 using 3.6 but I can't find a source for that.
>
> It seems like we should look into bumping the minimum version but I
> tend to refresh my system a little more often so I don't know what
> pain this would cause others
>
> [0] https://devguide.python.org/versions/
> [1] https://wiki.debian.org/Python
> [2] https://packages.ubuntu.com/search?keywords=python3
> [3] https://github.com/openembedded/openembedded-core/blob/c4fb7d1f0f157ffafd9f907f49ea74b93b2c1d40/meta/recipes-devtools/python/python3_3.8.18.bb#L67
We partly hit this because Ubuntu 20.04 is on, uh, I forget what Tim
said now. But I really like to be able to say we work on the oldest
still supported common LTS distributions. We may have to bump to 3.7 or
newer after v2025.10 so that we don't run in to too many problems with
bleeding edge distributions instead.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250714/6f81efbc/attachment.sig>
More information about the U-Boot
mailing list