Drop Python 3.8 and 3.9 support (following NEP 29) #129805
Labels
module: python frontend
For issues relating to PyTorch's Python frontend
oncall: releng
In support of CI and Release Engineering
release notes: releng
release notes category
tracker
A tracking issue
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Uh oh!
There was an error while loading. Please reload this page.
#74203 adopted NEP29 and the schedule says that Python 3.8 was dropped on Apr 14, 2023, and Python 3.9 a week ago
on Jun 22, 2024.
Is there any issue with dropping these Python versions?
This can also help with unifying
numpy
versions in #128860.This can also help with the type annotation issue for #117449.
When we drop Python 3.8, we can use generic type-alias which are added in Python 3.9.
typing.List[T] -> list[T]
,typing.Dict[KT, VT] -> dict[KT, VT]
,typing.Type[T] -> type[T]
.This allows us to remove lots of imports from
typing
and also resolve an issue commented on Use Generic TypeAlias (PEP 585) and Union Type (PEP 604) in generated.pyi
stub files #129420 (comment).This migration is auto-fixable by
ruff
rule non-pep585-annotation (UP006) when we settarget-version
topy39
.When we drop Python 3.9, we can use union-type which is added in Python 3.10.
Union[X, Y] -> X | Y
,Optional[X] -> X | None
,Optional[Union[X, Y]] -> X | Y | None
.This allows us to remove the import of
typing.Union
andtyping.Optional
and completely removefrom __future__ import annotations
.This migration is auto-fixable by
ruff
rule non-pep604-annotation (UP007) when we settarget-version
topy310
.cc @albanD @malfet
The text was updated successfully, but these errors were encountered: