-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Problem statement
Since our current minimum required Python version (3.8) [1] reached its end of life quite some time ago, and with 3.9 recently following while 3.10 is approaching end of life October next year, it’s a good moment to revisit our minimum version requirement.
According to a JetBrains report [2], Python 3.12 has become the new sheriff in town, with 3.11 and 3.10 still holding usage shares of at least 15%.
To strike a balance between usability and long-term support, I suggest raising our minimum supported version to either Python 3.10 or 3.11.
Solution
Agree on a new python version and update our entire code-base to align with features available in our target minimum Python version.
As an example for 3.10 this includes, but is not limited to:
-
Adapt newly introduced type hint styles
- Utilize
Annotatedfor richer type hints (3.9) - Use
TypeAliasfor clearer type definitions (3.10) - Apply union types with
X | Ysyntax (3.10) - Implement Parameter Specification Variables (
ParamSpec) for higher-order functions (3.10) - Define User-Defined Type Guards (3.10)
- Utilize
-
Update project configuration files, such as
pyproject.toml, CI actions, etc.- Update
python_requiresinpyproject.tomlto>=3.10 - Ensure CI workflows test against Python 3.10 and above
- Remove any backward-compatibility workarounds no longer needed
- Update dependencies that now require >=3.10
- Update
-
Utilize new language features
- Refactor
if-elif-elsechains tomatch-casestatements (3.10) - Explore structural pattern matching with sequences, mappings, and class patterns (3.10)
- Use
str.removeprefix()/str.removesuffix()(3.9) - Consider improvements to built-in collections, e.g.,
zoneinfomodule (3.9) - Explore parenthesized context managers for cleaner multi-line
withstatements (3.10)
- Refactor
Additional Context
No response