Skip to content

chore!: drop Python 3.9 support#364

Open
gruebel wants to merge 3 commits intomainfrom
drop-py39
Open

chore!: drop Python 3.9 support#364
gruebel wants to merge 3 commits intomainfrom
drop-py39

Conversation

@gruebel
Copy link
Member

@gruebel gruebel commented Mar 14, 2026

This PR

  • it looks like a lot of changes, but they are just type annotations
  • also updated pytest to v9, which was blocked by dropping Python 3.9 support 😅

Related Issues

Relates open-feature/python-sdk#554

Notes

Don't merge it yet, I want to release some packages before automatically increasing the minor version

Signed-off-by: gruebel <anton.gruebel@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the project's Python environment by removing support for Python 3.9 and upgrading key development dependencies, most notably pytest. The changes primarily involve updating configuration files to reflect the new minimum Python version and refactoring type annotations to utilize Python 3.10's native union syntax, leading to cleaner and more readable code.

Highlights

  • Python 3.9 Support Dropped: The project has officially dropped support for Python 3.9, aligning with Python 3.10+.
  • Pytest Upgrade: The pytest testing framework has been upgraded to version 9 across various modules.
  • Type Annotation Modernization: Numerous type annotations have been updated to use the native | union operator and None instead of typing.Optional and typing.Union, leveraging Python 3.10+ syntax.
Changelog
  • hooks/openfeature-hooks-opentelemetry/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-aws-ssm/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the pytest-asyncio dependency to a newer range.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-aws-ssm/src/openfeature/contrib/provider/awsssm/config.py
    • Updated type annotations to use native union syntax (| None) for optional fields.
  • providers/openfeature-provider-aws-ssm/src/openfeature/contrib/provider/awsssm/parsers.py
    • Removed Union import from typing.
    • Updated type annotations to use native union syntax (|) for return types.
  • providers/openfeature-provider-aws-ssm/src/openfeature/contrib/provider/awsssm/provider.py
    • Adjusted imports from collections.abc and typing.
    • Updated type annotations to use native union syntax (| None) for optional parameters and attributes.
  • providers/openfeature-provider-aws-ssm/src/openfeature/contrib/provider/awsssm/ssm_service.py
    • Removed Optional import from typing.
    • Updated type annotations to use native union syntax (| None) for optional parameters and attributes.
  • providers/openfeature-provider-aws-ssm/tests/conftest.py
    • Removed Union import from typing.
    • Updated type annotations to use native union syntax (|) for _PatchedAWSResponseContent.content.
  • providers/openfeature-provider-env-var/.python-version
    • Removed the Python version file.
  • providers/openfeature-provider-env-var/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-env-var/src/openfeature/contrib/provider/envvar/provider.py
    • Updated type annotations to use native union syntax (| None) for optional parameters and (|) for union types.
  • providers/openfeature-provider-flagd/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/config.py
    • Updated type annotations to use native union syntax (| None) for optional parameters and attributes, and (|) for union types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/provider.py
    • Updated type annotations to use native union syntax (| None) for optional parameters and (|) for union types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py
    • Updated type annotations to use native union syntax (| None) for optional attributes and parameters, and (|) for union types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/in_process.py
    • Updated type annotations to use native union syntax (| None) for optional parameters and (|) for union types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/connector/file_watcher.py
    • Updated type annotation to use native union syntax (| None) for modified_time parameter.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py
    • Updated type annotations to use native union syntax (| None) for optional attributes and return types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/custom_ops.py
    • Added Sequence import from collections.abc.
    • Replaced typing.Union with native union syntax (|) for type aliases JsonPrimitive and JsonLogicArg.
    • Updated type annotations to use native union syntax (| None) for optional return types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/flags.py
    • Updated type annotations to use native union syntax (|) for union types and (| None) for optional attributes and return types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/process/targeting.py
    • Updated type annotation to use native union syntax (| None) for evaluation_context parameter.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/protocol.py
    • Updated type annotations to use native union syntax (| None) for optional parameters and (|) for union types.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/types.py
    • Updated type annotations to use native union syntax (| None) for optional fields in GrpcMultiCallableArgs.
  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/sync_metadata_hook.py
    • Updated type annotation to use native union syntax (| None) for the return type of the before method.
  • providers/openfeature-provider-flagd/tests/e2e/conftest.py
    • Removed typing import and JsonPrimitive type alias.
  • providers/openfeature-provider-flagd/tests/e2e/flagd_container.py
    • Removed typing import.
    • Updated type annotation to use native union syntax (| None) for the feature parameter.
  • providers/openfeature-provider-flagd/tests/e2e/step/_utils.py
    • Replaced typing.Union with native union syntax (|) for type aliases JsonObject and JsonPrimitive.
  • providers/openfeature-provider-flagd/tests/e2e/step/config_steps.py
    • Removed typing import.
    • Updated type annotation to use native union syntax (|) for convert_resolver_type parameter.
  • providers/openfeature-provider-flagd/tests/e2e/step/context_steps.py
    • Removed typing import.
    • Updated type annotation to use native union syntax (|) for the value parameter.
  • providers/openfeature-provider-flagd/tests/test_grpc_watcher.py
    • Removed typing import.
    • Updated type annotations to use native union syntax (| None) for optional attributes.
  • providers/openfeature-provider-flagd/tests/test_targeting.py
    • Removed typing import.
    • Updated type annotation to use native union syntax (| None) for SemVerTest.result.
  • providers/openfeature-provider-flipt/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the types-requests dependency to a newer range and removed a related comment.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-flipt/src/openfeature/contrib/provider/flipt/init.py
    • Adjusted imports from typing to collections.abc.
    • Updated type annotations to use native union syntax (| None) for optional parameters.
  • providers/openfeature-provider-ofrep/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the types-requests dependency to a newer range and removed a related comment.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section.
  • providers/openfeature-provider-ofrep/src/openfeature/contrib/provider/ofrep/init.py
    • Adjusted imports from collections.abc and typing.
    • Updated TypeMap type alias to use native union syntax (|).
    • Updated type annotations to use native union syntax (| None) for optional parameters and attributes, and (|) for union types.
  • providers/openfeature-provider-unleash/README.md
    • Updated the Python requirement from 3.9+ to 3.10+.
  • providers/openfeature-provider-unleash/pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the pytest-asyncio dependency to a newer range.
    • Updated the mypy Python version configuration to 3.10.
    • Added a strict configuration for pytest in the tool.pytest section and moved markers under it.
  • providers/openfeature-provider-unleash/src/openfeature/contrib/provider/unleash/init.py
    • Adjusted imports from collections.abc and typing.
    • Updated type annotations to use native union syntax (| None) for optional parameters and attributes, and (|) for union types.
  • providers/openfeature-provider-unleash/src/openfeature/contrib/provider/unleash/events.py
    • Adjusted imports from collections.abc and typing.
  • providers/openfeature-provider-unleash/src/openfeature/contrib/provider/unleash/flag_evaluation.py
    • Adjusted imports from collections.abc and typing.
    • Updated type annotations to use native union syntax (| None) for optional parameters and return types.
  • pyproject.toml
    • Updated the minimum required Python version to 3.10.
    • Upgraded the pytest dependency to version 9.
    • Updated the ruff target Python version to 3.10.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/build.yml
    • .github/workflows/release.yml
Activity
  • The author, gruebel, has indicated that the pull request should not be merged yet, as they intend to release some packages before automatically increasing the minor version.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.67%. Comparing base (8592c28) to head (550444d).

Additional details and impacted files
@@             Coverage Diff             @@
##              main     #364      +/-   ##
===========================================
- Coverage   100.00%   95.67%   -4.33%     
===========================================
  Files            2       30      +28     
  Lines           36     1455    +1419     
===========================================
+ Hits            36     1392    +1356     
- Misses           0       63      +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request drops support for Python 3.9, making 3.10 the new minimum required version. The changes primarily involve updating type hints to use the modern | syntax for unions, which has been applied consistently throughout the codebase. Additionally, pytest has been upgraded to version 9. I've identified a couple of critical issues related to an incorrect dependency version for pytest-asyncio and a faulty type alias definition that will need to be addressed. Otherwise, the changes look good.

Signed-off-by: gruebel <anton.gruebel@gmail.com>
@gruebel gruebel requested a review from toddbaert March 16, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants