Repository navigation
[FSSDK-13300] Remove dead Python 3.7 typing guards - #526
Open
FarhanAnjum-opti wants to merge 2 commits into
Open
FarhanAnjum-opti wants to merge 2 commits into
FarhanAnjum-opti wants to merge 2 commits into
Conversation
mypy 2.4.0 rejects the `if version_info < (3, 8)` conditional Protocol imports, failing type-check on every PR. Those branches only run on Python 3.7, which has been unsupported since 5.0, so import Final, Literal, Protocol and TypedDict directly from typing. Drop the mypy.ini unused-ignore override that existed only for the old TypedDict import, and pin mypy~=2.4.0 so new mypy releases can't break CI unannounced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep requirements/typing.txt as on master. The typing import cleanup alone fixes the mypy 2.4.0 failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
if version_info < (3, 8): from typing_extensions import ... else: from typing import ...block (20 modules) with a directtypingimport ofFinal,Literal,ProtocolorTypedDict, and drop the now-unusedfrom sys import version_infoimports[mypy-optimizely.helpers.types]no_warn_unused_ignoresoverride inmypy.ini. It only existed for the# type: ignoreon the old conditionalTypedDictimport, which is gone.Why:
type-check (3.11)andtype-check (3.12)have failed on every PR and onmastersince mypy 2.4.0 was released (2026-10-01 20:39 UTC; the last green run was at 20:10 UTC). mypy 2.4.0 treatstyping.Protocolandtyping_extensions.Protocolas different types, so it flags the conditional import as an incompatible redefinition:The
< (3, 8)branches only run on Python 3.7, which hasn't been supported since 5.0 (README: "Version 5.0+: Python 3.8+"), so this removes dead code and changes no runtime behavior on any supported version.requirements/typing.txtis unchanged, so mypy stays unpinned as onmaster.Not in this PR: the
version_info < (3, 10)TypeGuardguard inevent/event_id_normalizer.pyis still needed while 3.9 is supported. Raising the minimum Python version is tracked separately in FSSDK-13301.Test plan
master: mypy 2.3.1 passes and mypy 2.4.0 fails with the 2 errors aboverequirements/typing.txt) on Python 3.11 and 3.12 passes both CI commands:mypy . --exclude "tests/testapp":Success: no issues found in 97 source filesmypy . --exclude "tests/" --strict:Success: no issues found in 57 source files. This also confirms the removedmypy.inioverride isn't needed.pytest --cov=optimizelyon Python 3.9, 3.11 and 3.12: 1036 passed on eachruff check .: all checks passedIssues
🤖 Generated with Claude Code