Repository navigation
[FSSDK-13301] Raise minimum Python to 3.10, add 3.13–3.15 - #530
Open
Farhan Anjum (FarhanAnjum-opti) wants to merge 3 commits into
Open
Farhan Anjum (FarhanAnjum-opti) wants to merge 3 commits into
Farhan Anjum (FarhanAnjum-opti) wants to merge 3 commits into
Conversation
- Remove the last version_info < (3, 10) guard; import TypeGuard from typing - setup.py: add python_requires='>=3.10'; classifiers 3.10–3.15 - README: add 5.9+ requirements row and EOL support policy - ruff target-version py39 -> py310 - CI: test on 3.10–3.15 and pypy-3.10/3.11/3.12; type-check on 3.10–3.15 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… wording The test forced a crash with a huge update_interval and matched CPython's OverflowError text, which changed in recent 3.13/3.14/3.15 patch releases. It could also pass without asserting anything if stop() won the race. Mock fetch_datafile to raise a known exception instead, and assert that the exception leaves the thread and is logged once. Also drop the README "Version 5.9+" row: the next version number is decided at release time, so the release PR adds that row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Muzahidul Islam (muzahidul-opti)
approved these changes
Nov 26, 2026
Muzahidul Islam (muzahidul-opti)
left a comment
Contributor
There was a problem hiding this comment.
Intent: raise the minimum to Python 3.10, add 3.13–3.15 to CI, and make the polling-thread test independent of CPython's error text.
I read the change end to end and found no blocking issues. The rewritten test_fetch_datafile__exception_polling_thread_failed is deterministic. It patches fetch_datafile to raise and threading.excepthook to capture, then asserts the thread stops and the error is logged before it re-raises. TypeGuard imports cleanly on 3.10+, and python_requires, the classifiers and the CI matrix agree. LGTM.
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
event/event_id_normalizer.py: remove the lastversion_info < (3, 10)guard. ImportTypeGuarddirectly fromtyping, and drop thetyping_extensionsfallback, which was never declared inrequirements/core.txt.setup.py: addpython_requires='>=3.10', and set the classifiers to 3.10–3.15.README.md: add a note that dropping an end-of-life Python version doesn't change the public API, so it ships in a minor release. The requirements row for the new version ("Version X.Y+: Python 3.10+, PyPy 3.10+") is left to the release PR, because the next version number isn't decided yet.tests/test_config_manager.py: rewritetest_fetch_datafile__exception_polling_thread_failedso it doesn't depend on CPython's error wording (see below).ruff.toml:target-versionpy39→py310.python.yml):testruns on 3.10–3.15 and pypy-3.10/3.11/3.12. 3.9 and pypy-3.9 are removed.type-checkruns on 3.10–3.15. It used to run on only 3.11 and 3.12.Why: Python 3.8 and 3.9 are end-of-life upstream (since 2024-10 and 2025-10). The latest
requests,jsonschema,referencing,urllib3,pytestandmypyall require 3.10+, so the 3.9 CI job was testing older dependency versions than users actually install. 3.13–3.15 were never tested at all. PyPy only goes up to 3.12, so there is no pypy-3.13 or later to add.What this means for users on 3.8 or 3.9: they stay on 5.8.x. No earlier release declares
Requires-Python, and this one declares>=3.10, so pip on 3.8 or 3.9 skips this release and installs the last 5.8.x. The public API is unchanged, so on 3.10+ this is a drop-in upgrade. This change doesn't require a major version on its own. The next release is a minor unless other breaking changes land first; see the ticket for the reasoning.Why 3.10 is kept, although it reached end-of-life on 2026-10-01
python3is 3.10, and Canonical keeps patching it until April 2027 (longer for ESM customers). For server-side users on that platform, "end-of-life upstream" doesn't mean unpatched.rpds-py<0.20.0; python_version < '3.11'pin and one CI job.requests,urllib3,jsonschemaandreferencingall accept 3.10. Onlyrpds-py(already pinned for 3.10) andcoverage(test-only) need 3.11+.python_requiresin place, a future drop is a small minor release that pip handles automatically. Dropping 3.9 and 3.10 together would affect more users and remove no code.3.10 will be dropped in its own minor release when the first of these happens:
requests,urllib3orjsonschemapublishes a release that requires 3.11+, so 3.10 users would stop receiving their fixes;Why the polling-thread test changed
Adding 3.13–3.15 to CI exposed a fragile test.
test (3.13),test (3.14)andtest (3.15)failed on one test each (1 failed, 1047 passed):test_fetch_datafile__exception_polling_thread_failed.Thread for background datafile polling failed. Error: ...and re-raises (PollingConfigManager._run).update_interval(12345678912345), sothreading.Event.wait()raisedOverflowError. Then it required CPython's error text to contain"timestamp too large to convert to C".timestamp out of range for C PyTime_t. Locally, 3.10–3.12 and also 3.13.0–3.13.14 and 3.14.6 still use the old wording. The SDK behaves the same on all of them: the thread fails and the error is logged. Only the text inside the error, which CPython owns, changed.stop()immediately. If that set the stop event before the thread reachedwait(), the wait returned at once, nothing was raised or logged, and the assertion loop ran zero times.The new test mocks
fetch_datafileto raiseException('boom')and captures what leaves the thread with a mockedthreading.excepthook. It asserts that:boom) was raised out of the thread;Thread for background datafile polling failed. Error: boomexactly once.It no longer depends on Python's error wording or on thread timing, and the docstring ("exception is raised when polling thread stops") now matches what is actually asserted. As a side effect, pytest no longer emits an "unhandled thread exception" warning for this test.
For the release PR
X.Y+: Python 3.10+, PyPy 3.10+".Test plan
test(3.10–3.15, pypy-3.10/3.11/3.12),type-check(3.10–3.15), lint. (fullstack-prod-suiteis excluded: it fails at its "Configure AWS Credentials" step on every run since at least 2026-11-23, unrelated to this PR.)python -m build: the wheelMETADATAcontainsRequires-Python: >=3.10and the 3.10–3.15 classifiers. pip 26 on Python 3.9.6 refuses it (requires a different Python: 3.9.6 not in '>=3.10').pytest: 1048 passed;mypy . --exclude "tests/testapp"andmypy . --exclude "tests/" --strictpass (mypy 2.4.1);ruff check .passes.pyteston 3.14.6: 1048 passed.Expected 'error' to be called once. Called 0 times.With the re-raise removed:1 != 0. (The SDK source was restored after each check.)git grep -nE "version_info|typing_extensions|sys\.version"matches onlyoptimizely/version.pyandsetup.py.CI's exact patch versions (3.13.18, 3.14.10, 3.15.2) and PyPy weren't available locally; CI covers them.
Issues
🤖 Generated with Claude Code