From 902119fd33931634859362e7e2d6c53c79ffc1d0 Mon Sep 17 00:00:00 2001 From: Nazanin Donyapour Date: Mon, 9 Mar 2026 18:22:34 +0000 Subject: [PATCH] Bump Python version to 3.13 --- .github/workflows/pythonbuild.yml | 31 ++++++++++++++----- .github/workflows/pythonpublish.yml | 1 + dev-requirements.in | 4 +-- flytekit/configuration/default_images.py | 2 ++ .../flytekitplugins/openai/batch/task.py | 1 + .../flytekitplugins/sqlalchemy/task.py | 1 + pyproject.toml | 3 +- .../unit/extras/pytorch/test_checkpoint.py | 5 +++ .../unit/extras/pytorch/test_native.py | 7 +++++ .../extras/pytorch/test_transformations.py | 5 +++ .../extras/tensorflow/model/test_model.py | 7 +++++ .../tensorflow/model/test_transformations.py | 5 +++ .../extras/tensorflow/record/test_record.py | 6 ++++ .../tensorflow/record/test_transformations.py | 6 ++++ 14 files changed, 74 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pythonbuild.yml b/.github/workflows/pythonbuild.yml index a62d7d0b7e..e5f4320133 100644 --- a/.github/workflows/pythonbuild.yml +++ b/.github/workflows/pythonbuild.yml @@ -27,7 +27,7 @@ jobs: - name: Set Python versions for run run: | if [[ ${{ github.event_name }} == "schedule" ]]; then - echo "python_versions=[\"3.10\",\"3.11\",\"3.12\"]" >> $GITHUB_ENV + echo "python_versions=[\"3.10\",\"3.11\",\"3.12\",\"3.13\"]" >> $GITHUB_ENV else echo "python_versions=[\"3.12\"]" >> $GITHUB_ENV fi @@ -110,9 +110,9 @@ jobs: uv pip uninstall --system pandas pyarrow uv pip freeze - name: Run extras unit tests with coverage - # Skip this step if running on python 3.12 due to https://github.com/tensorflow/tensorflow/issues/62003 + # Skip this step if running on python 3.12+ due to https://github.com/tensorflow/tensorflow/issues/62003 # and https://github.com/pytorch/pytorch/issues/110436 - if: ${{ matrix.python-version != '3.12' }} + if: ${{ matrix.python-version != '3.12' && matrix.python-version != '3.13' }} run: | make unit_test_extras_codecov - name: Codecov @@ -139,6 +139,8 @@ jobs: pandas: "pandas>=2.0.0" - pandas: "pandas<2.0.0" python-version: "3.12" + - pandas: "pandas<2.0.0" + python-version: "3.13" steps: - uses: actions/checkout@v4 @@ -370,24 +372,39 @@ jobs: # See: https://github.com/flyteorg/flytekit/actions/runs/4493746408/jobs/7905368664 - python-version: 3.11 plugin-names: "flytekit-whylogs" - # apache-beam, one of flytekit-airflow dependencies, does not support python 3.12: https://github.com/apache/beam/issues/29149 + # apache-beam, one of flytekit-airflow dependencies, does not support python 3.12+: https://github.com/apache/beam/issues/29149 - python-version: 3.12 plugin-names: "flytekit-airflow" + - python-version: 3.13 + plugin-names: "flytekit-airflow" # Tensorflow is a dependency of flytekit-mlflow tests and that is not supported yet: https://github.com/tensorflow/tensorflow/issues/62003 - python-version: 3.12 plugin-names: "flytekit-mlflow" - # modin[ray] is a dependency needed to run the tests, unfortunately this is not supported in python 3.12 yet + - python-version: 3.13 + plugin-names: "flytekit-mlflow" + # modin[ray] is a dependency needed to run the tests, unfortunately this is not supported in python 3.12+ yet - python-version: 3.12 plugin-names: "flytekit-modin" - # vaex currently doesn't support python 3.12 + - python-version: 3.13 + plugin-names: "flytekit-modin" + # vaex currently doesn't support python 3.12+ - python-version: 3.12 plugin-names: "flytekit-vaex" - # Ray does not support python 3.12 yet: https://github.com/ray-project/ray/issues/40211 + - python-version: 3.13 + plugin-names: "flytekit-vaex" + # Ray does not support python 3.12+ yet: https://github.com/ray-project/ray/issues/40211 - python-version: 3.12 plugin-names: "flytekit-ray" + - python-version: 3.13 + plugin-names: "flytekit-ray" # Segmentation fault on python 3.12: https://github.com/flyteorg/flyte/issues/5020 - python-version: 3.12 plugin-names: "flytekit-kf-pytorch" + - python-version: 3.13 + plugin-names: "flytekit-kf-pytorch" + # onnx-pytorch does not support python 3.12+ yet + - python-version: 3.13 + plugin-names: "flytekit-onnx-pytorch" steps: - uses: actions/checkout@v4 - name: "Clear action cache" diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 8eeffe5668..0687125b1b 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -82,6 +82,7 @@ jobs: - "3.10" - "3.11" - "3.12" + - "3.13" steps: - uses: actions/checkout@v4 with: diff --git a/dev-requirements.in b/dev-requirements.in index cef6ce1929..1af3c9025d 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -21,13 +21,13 @@ keyrings.alt setuptools_scm pytest-icdiff -# Tensorflow is not available for python 3.12 yet: https://github.com/tensorflow/tensorflow/issues/62003 +# Tensorflow is not available for python 3.12+ yet: https://github.com/tensorflow/tensorflow/issues/62003 tensorflow<=2.15.1; python_version<'3.12' # Newer versions of torch bring in nvidia dependencies that are not present in windows, so # we put this constraint while we do not have per-environment requirements files torch<=1.12.1; python_version<'3.11' # pytorch 2 supports python 3.11 -# pytorch 2 does not support 3.12 yet: https://github.com/pytorch/pytorch/issues/110436 +# pytorch 2 does not support 3.12+ yet: https://github.com/pytorch/pytorch/issues/110436 torch; python_version<'3.12' pydantic diff --git a/flytekit/configuration/default_images.py b/flytekit/configuration/default_images.py index 47353cf5af..ecddde43f6 100644 --- a/flytekit/configuration/default_images.py +++ b/flytekit/configuration/default_images.py @@ -13,6 +13,7 @@ class PythonVersion(enum.Enum): PYTHON_3_10 = (3, 10) PYTHON_3_11 = (3, 11) PYTHON_3_12 = (3, 12) + PYTHON_3_13 = (3, 13) class DefaultImages(object): @@ -26,6 +27,7 @@ class DefaultImages(object): PythonVersion.PYTHON_3_10: "cr.flyte.org/flyteorg/flytekit:py3.10-", PythonVersion.PYTHON_3_11: "cr.flyte.org/flyteorg/flytekit:py3.11-", PythonVersion.PYTHON_3_12: "cr.flyte.org/flyteorg/flytekit:py3.12-", + PythonVersion.PYTHON_3_13: "cr.flyte.org/flyteorg/flytekit:py3.13-", } @classmethod diff --git a/plugins/flytekit-openai/flytekitplugins/openai/batch/task.py b/plugins/flytekit-openai/flytekitplugins/openai/batch/task.py index 7c7715f9f5..77643706be 100644 --- a/plugins/flytekit-openai/flytekitplugins/openai/batch/task.py +++ b/plugins/flytekit-openai/flytekitplugins/openai/batch/task.py @@ -64,6 +64,7 @@ class OpenAIFileDefaultImages(DefaultImages): PythonVersion.PYTHON_3_10: "cr.flyte.org/flyteorg/flytekit:py3.10-openai-batch-", PythonVersion.PYTHON_3_11: "cr.flyte.org/flyteorg/flytekit:py3.11-openai-batch-", PythonVersion.PYTHON_3_12: "cr.flyte.org/flyteorg/flytekit:py3.12-openai-batch-", + PythonVersion.PYTHON_3_13: "cr.flyte.org/flyteorg/flytekit:py3.13-openai-batch-", } diff --git a/plugins/flytekit-sqlalchemy/flytekitplugins/sqlalchemy/task.py b/plugins/flytekit-sqlalchemy/flytekitplugins/sqlalchemy/task.py index 1e91fb55b5..2b21d9b455 100644 --- a/plugins/flytekit-sqlalchemy/flytekitplugins/sqlalchemy/task.py +++ b/plugins/flytekit-sqlalchemy/flytekitplugins/sqlalchemy/task.py @@ -26,6 +26,7 @@ class SQLAlchemyDefaultImages(DefaultImages): PythonVersion.PYTHON_3_10: "cr.flyte.org/flyteorg/flytekit:py3.10-sqlalchemy-", PythonVersion.PYTHON_3_11: "cr.flyte.org/flyteorg/flytekit:py3.11-sqlalchemy-", PythonVersion.PYTHON_3_12: "cr.flyte.org/flyteorg/flytekit:py3.12-sqlalchemy-", + PythonVersion.PYTHON_3_13: "cr.flyte.org/flyteorg/flytekit:py3.13-sqlalchemy-", } diff --git a/pyproject.toml b/pyproject.toml index 82b8c6c054..28b42d27d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [{ name = "Flyte Contributors", email = "admin@flyte.org" }] description = "Flyte SDK for Python" license = { text = "Apache-2.0" } readme = { file = "README.md", content-type = "text/markdown" } -requires-python = ">=3.10,<3.13" +requires-python = ">=3.10,<3.14" dependencies = [ # Please maintain an alphabetical order in the following list "adlfs>=2023.3.0", @@ -61,6 +61,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development", diff --git a/tests/flytekit/unit/extras/pytorch/test_checkpoint.py b/tests/flytekit/unit/extras/pytorch/test_checkpoint.py index 10721bf237..a7d41fec48 100644 --- a/tests/flytekit/unit/extras/pytorch/test_checkpoint.py +++ b/tests/flytekit/unit/extras/pytorch/test_checkpoint.py @@ -1,7 +1,12 @@ +import sys from dataclasses import asdict, dataclass from typing import NamedTuple import pytest + +pytest.importorskip("torch", reason="torch is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="torch is not available for Python 3.12+") + import torch.nn as nn import torch.nn.functional as F import torch.optim as optim diff --git a/tests/flytekit/unit/extras/pytorch/test_native.py b/tests/flytekit/unit/extras/pytorch/test_native.py index 9d44ed1c1f..0105fc6e34 100644 --- a/tests/flytekit/unit/extras/pytorch/test_native.py +++ b/tests/flytekit/unit/extras/pytorch/test_native.py @@ -1,3 +1,10 @@ +import sys + +import pytest + +pytest.importorskip("torch", reason="torch is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="torch is not available for Python 3.12+") + import torch from flytekit import task, workflow diff --git a/tests/flytekit/unit/extras/pytorch/test_transformations.py b/tests/flytekit/unit/extras/pytorch/test_transformations.py index 4bc81bb3a0..9a2342a434 100644 --- a/tests/flytekit/unit/extras/pytorch/test_transformations.py +++ b/tests/flytekit/unit/extras/pytorch/test_transformations.py @@ -1,7 +1,12 @@ +import sys from collections import OrderedDict from typing import Union import pytest + +pytest.importorskip("torch", reason="torch is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="torch is not available for Python 3.12+") + import torch import flytekit diff --git a/tests/flytekit/unit/extras/tensorflow/model/test_model.py b/tests/flytekit/unit/extras/tensorflow/model/test_model.py index 2464345986..f684c759a0 100644 --- a/tests/flytekit/unit/extras/tensorflow/model/test_model.py +++ b/tests/flytekit/unit/extras/tensorflow/model/test_model.py @@ -1,3 +1,10 @@ +import sys + +import pytest + +pytest.importorskip("tensorflow", reason="tensorflow is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="tensorflow is not available for Python 3.12+") + import tensorflow as tf from flytekit import task, workflow diff --git a/tests/flytekit/unit/extras/tensorflow/model/test_transformations.py b/tests/flytekit/unit/extras/tensorflow/model/test_transformations.py index 7bc487b0a5..e79217562e 100644 --- a/tests/flytekit/unit/extras/tensorflow/model/test_transformations.py +++ b/tests/flytekit/unit/extras/tensorflow/model/test_transformations.py @@ -1,7 +1,12 @@ +import sys from collections import OrderedDict import numpy as np import pytest + +pytest.importorskip("tensorflow", reason="tensorflow is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="tensorflow is not available for Python 3.12+") + import tensorflow as tf import flytekit diff --git a/tests/flytekit/unit/extras/tensorflow/record/test_record.py b/tests/flytekit/unit/extras/tensorflow/record/test_record.py index ba0c424671..aba5df8a24 100644 --- a/tests/flytekit/unit/extras/tensorflow/record/test_record.py +++ b/tests/flytekit/unit/extras/tensorflow/record/test_record.py @@ -1,6 +1,12 @@ +import sys from typing import Dict, Tuple import numpy as np +import pytest + +pytest.importorskip("tensorflow", reason="tensorflow is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="tensorflow is not available for Python 3.12+") + import tensorflow as tf from tensorflow.python.data.ops.readers import TFRecordDatasetV2 from typing_extensions import Annotated diff --git a/tests/flytekit/unit/extras/tensorflow/record/test_transformations.py b/tests/flytekit/unit/extras/tensorflow/record/test_transformations.py index f236696a0c..8bc621b0b7 100644 --- a/tests/flytekit/unit/extras/tensorflow/record/test_transformations.py +++ b/tests/flytekit/unit/extras/tensorflow/record/test_transformations.py @@ -1,4 +1,10 @@ +import sys + import pytest + +pytest.importorskip("tensorflow", reason="tensorflow is not available for Python 3.12+") +pytestmark = pytest.mark.skipif(sys.version_info >= (3, 12), reason="tensorflow is not available for Python 3.12+") + import tensorflow import tensorflow as tf from tensorflow.core.example.example_pb2 import Example