Add Python 3.13 support - #3465
Open
bochinski wants to merge 4 commits into
Open
Conversation
bochinski
requested review from
cosmicBboy,
davidmirror-ops,
kumare3,
machichima,
pingsutw,
samhita-alla and
wild-endeavor
as code owners
September 3, 2026 16:21
bochinski
marked this pull request as draft
September 3, 2026 16:26
bochinski
force-pushed
the
feat/python-3.13-3.14-support
branch
from
September 3, 2026 16:35
1310769 to
564041e
Compare
- pyproject.toml: requires-python ">=3.10,<3.14", add the 3.13 classifier; regenerate uv.lock accordingly. - PythonVersion enum and default image prefixes: add 3.13 in flytekit core, the sqlalchemy plugin and the openai batch plugin. Without it, DefaultImages.find_image_for() raises "(3, 13) is not a valid PythonVersion" on 3.13. - CI (pythonbuild.yml): run 3.13 on pull requests and in the nightly matrix, enable the extras (tensorflow/pytorch) tests on 3.13, exclude pandas<2 and plugins whose dependencies do not support 3.13 yet. - dev-requirements.in: tensorflow>=2.21 and torch>=2.6 on 3.13; lift the protobuf<5 dev pin on 3.13 only (tensorflow 2.21 needs protobuf>=6, and the issue behind the pin, flyteorg/flyte#5448, was fixed upstream). - Publish py3.13 images in pythonpublish.yml and build_image.yml. - pytorch extras: torch>=2.6 defaults torch.load(weights_only=True), which cannot load the whole nn.Module / checkpoint objects flytekit stores. Pass weights_only=False where the keyword exists. This is required for the extras tests on 3.13 and already fails in the nightly 3.11 run. Closes flyteorg/flyte#6993 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
bochinski
force-pushed
the
feat/python-3.13-3.14-support
branch
from
September 3, 2026 16:52
564041e to
605e0b1
Compare
The tensorflow and pytorch transformer tests were skipped on 3.12 because neither library had 3.12 wheels when 3.12 support was added. Both upstream issues have been closed since: tensorflow ships 3.12 wheels from 2.16 (tensorflow/tensorflow#62003) and pytorch from 2.2 (pytorch/pytorch#110436). - dev-requirements.in: install tensorflow on >=3.12 and torch on >=3.11 with a single line each instead of per-version lines. With the protobuf<5 pin that is kept on <3.13, 3.12 resolves to tensorflow 2.19 and 3.13 to the latest release. - pythonbuild.yml: drop the 3.12 skip of the extras step. Effect on the resolved dev environments: 3.10, 3.11 and 3.13 are unchanged. On 3.12 every job that installs dev-requirements.in now also gets tensorflow 2.19 and torch 2.14 (including the CUDA wheels torch pulls in on linux), and numpy is capped to 2.1.x by tensorflow 2.19. Verified locally on 3.12 with tensorflow 2.19.1 / torch 2.14.0 / protobuf 4.25.9: unit_test_extras 123 passed, unit_test 1970 + 25 passed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
Commit 605e0b1 passed weights_only=False to torch.load for every pytorch transformer. Plain tensors load fine under torch's default (weights_only=True since torch 2.6), so there is no reason to give up the restricted unpickler for them. Only whole nn.Module objects and checkpoint dicts, whose hyperparameters can be arbitrary objects, need full unpickling. - native.py: rename the helper to load_torch_object and give it a weights_only parameter; None keeps torch's default. The base transformer carries a WEIGHTS_ONLY class attribute (None), the module transformer sets it to False. The docstring states that weights_only=False executes pickle code from the blob, with the same trust model as FlytePickle. - checkpoint.py: call load_torch_object(..., weights_only=False). - tests: cover the keyword handling (default, explicit, and torch<1.13 without the keyword), the per-transformer setting, and a module round trip through the full unpickler. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
- Pull requests run a single interpreter version again (the convention since flyteorg#3380), now 3.13 instead of 3.12. The nightly matrix still covers 3.10 to 3.13. This halves the pull request matrix and keeps the heavier 3.12 dev environment (tensorflow/torch) out of pull request runs. - Reword the comment on the 3.13 plugin exclusions: they mirror the 3.12 list but have not been verified on 3.13, several of the underlying issues are closed by now. - The tensorflow releases with 3.13 wheels require protobuf>=5, not >=6 (2.20 needs 5.28, 2.21 needs 6.31). - dev-requirements.in: give types-protobuf the same version split as protobuf, so the stubs match the runtime on 3.13. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: bochinski <30434375+bochinski@users.noreply.github.com>
bochinski
force-pushed
the
feat/python-3.13-3.14-support
branch
from
September 3, 2026 18:35
51bac2f to
750bea8
Compare
bochinski
marked this pull request as ready for review
September 3, 2026 18:47
kumare3
approved these changes
Sep 4, 2026
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.
Tracking issue
Closes flyteorg/flyte#6993
Why are the changes needed?
flytekit declares
requires-python = ">=3.10,<3.13"and cannot be installed on Python 3.13. This PR adds 3.13 to the supported and tested versions. Python 3.14 is out of scope:flyteidldeclaresrequires-python <3.14, so flytekit cannot be installed on 3.14 regardless of this repo.What changes were proposed in this pull request?
pyproject.toml:requires-python = ">=3.10,<3.14", 3.13 classifier.uv.lockregenerated (not used by CI); the lock was also behindpyproject.tomlon master, so the diff additionally catches up flyteidl 1.16.4 -> 1.16.8 and the fsspec/gcsfs/s3fs bounds.PythonVersionenum and default image prefixes: add 3.13 (core, sqlalchemy and openai-batch images). Without itDefaultImages.find_image_for()raisesValueErroron 3.13.pandas<2is excluded (no wheels). The plugin matrix mirrors the 3.12 exclusions (not verified on 3.13; several of the underlying issues are closed by now) and adds duckdb (python_requires<3.13); mlflow stays excluded because its tests need tensorflow, which on 3.13 requires protobuf 5+.dev-requirements.in: tensorflow on >=3.12 and torch on >=3.11, and the 3.12 skip of the extras job is removed (Support Python 3.12 tensorflow/tensorflow#62003 and Pytorch for Python 3.12 not available pytorch/pytorch#110436 are closed).protobuf<5(andtypes-protobuf<5) is kept on <3.13 only: tensorflow releases with 3.13 wheels need protobuf 5+, and the reason for the pin ([Housekeeping] Add support for protobuf version 5 in flytekit flyte#5448) was fixed upstream. 3.10 and 3.11 resolve to the same versions as before. On 3.12 every job that installs this file now also gets tensorflow 2.19 and torch 2.14 (with CUDA wheels on linux), and numpy is capped to 2.1.x by tensorflow 2.19.py3.13-*images.torch.load(..., weights_only=False)fornn.Moduleand checkpoint objects, where the keyword exists. The default flipped toTruein torch 2.6 and cannot unpickle those (this is also the current nightly 3.11 failure on master). Tensors keep torch's default.weights_only=Falseexecutes pickle code from the blob, the same trust model asFlytePickle.How was this patch tested?
Locally on Linux x86_64 with uv and docker.
make unit_test1970 + 25 passed,make test_serialization78411 passed,make unit_test_extras128 passed (tensorflow 2.21 / torch 2.14 / protobuf 7).make unit_testandmake unit_test_extraspass (tensorflow 2.19 / torch 2.14 / protobuf 4.25).dev-requirements.inresolves for 3.10–3.13 on linux and 3.12/3.13 on windows and macos; every plugin dry-run resolves on 3.13 except mlflow and duckdb.Check all the applicable boxes
Related PRs
Supersedes #3401 and #3368.
🤖 Generated with Claude Code