Skip to content

[Feature Request]: Update required python version to >= 3.10 #836

@MaxDall

Description

@MaxDall

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 Annotated for richer type hints (3.9)
    • Use TypeAlias for clearer type definitions (3.10)
    • Apply union types with X | Y syntax (3.10)
    • Implement Parameter Specification Variables (ParamSpec) for higher-order functions (3.10)
    • Define User-Defined Type Guards (3.10)
  • Update project configuration files, such as pyproject.toml, CI actions, etc.

    • Update python_requires in pyproject.toml to >=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
  • Utilize new language features

    • Refactor if-elif-else chains to match-case statements (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., zoneinfo module (3.9)
    • Explore parenthesized context managers for cleaner multi-line with statements (3.10)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureHave an idea on how to improve the code base? Come forward and let us know.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions