diff --git a/.github/workflows/all-checks.yml b/.github/workflows/all-checks.yml index afd9caced0..c108d1ad42 100644 --- a/.github/workflows/all-checks.yml +++ b/.github/workflows/all-checks.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [ windows-latest, ubuntu-latest ] - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] uses: ./.github/workflows/unit-tests.yml with: os: ${{ matrix.os }} @@ -36,7 +36,7 @@ jobs: strategy: matrix: os: [ windows-latest, ubuntu-latest ] - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] uses: ./.github/workflows/e2e-tests.yml with: os: ${{ matrix.os }} @@ -59,7 +59,7 @@ jobs: strategy: matrix: os: [ windows-latest, ubuntu-latest ] - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] uses: ./.github/workflows/pip-compile.yml with: os: ${{ matrix.os }} diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 329278919e..51ab45c362 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -16,7 +16,7 @@ jobs: python-version: '3.11' - name: Install uv run: | - python -m pip install "uv==0.1.32" + python -m pip install "uv==0.4.29" - name: Install dependencies run: | uv pip install --system requests @@ -52,7 +52,7 @@ jobs: python-version: '3.11' - name: Install uv run: | - python -m pip install "uv==0.1.32" + python -m pip install "uv==0.4.29" - name: Install dependencies run: | uv pip install --system build diff --git a/.github/workflows/docs-only-checks.yml b/.github/workflows/docs-only-checks.yml index edd95de234..8f1098baa2 100644 --- a/.github/workflows/docs-only-checks.yml +++ b/.github/workflows/docs-only-checks.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] uses: ./.github/workflows/lint.yml with: os: ${{ matrix.os }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9a5c5397c..aea1855741 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ default_stages: [pre-commit, manual] repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.1 + rev: v0.7.1 hooks: - id: ruff name: "ruff on kedro/, tests/ and docs/" diff --git a/Makefile b/Makefile index e3f1e7b5c8..8095b52cc2 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ package: clean install python -m pip install build && python -m build install-test-requirements: - python -m pip install "uv==0.1.32" + python -m pip install "uv==0.4.29" uv pip install --system "kedro[test] @ ." install-pre-commit: diff --git a/RELEASE.md b/RELEASE.md index c9a5752ef2..1ed1851de3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,7 @@ # Upcoming Release ## Major features and improvements +* Add official support for Python 3.13. * Implemented dict-like interface for `KedroDataCatalog`. * Implemented lazy dataset initializing for `KedroDataCatalog`. * Project dependencies on both the default template and on starter templates are now explicitly declared on the `pyproject.toml` file, allowing Kedro projects to work with project management tools like `uv`, `pdm`, and `rye`. diff --git a/kedro/__init__.py b/kedro/__init__.py index 00ebebc5a7..afb4928658 100644 --- a/kedro/__init__.py +++ b/kedro/__init__.py @@ -21,7 +21,7 @@ class KedroPythonVersionWarning(UserWarning): warnings.simplefilter("default", KedroDeprecationWarning) warnings.simplefilter("error", KedroPythonVersionWarning) -if sys.version_info >= (3, 13): +if sys.version_info >= (3, 14): warnings.warn( """Kedro is not yet fully compatible with this Python version. To proceed at your own risk and ignore this warning, diff --git a/tests/framework/cli/micropkg/test_micropkg_pull.py b/tests/framework/cli/micropkg/test_micropkg_pull.py index 5bafa9fc11..55ca7be45f 100644 --- a/tests/framework/cli/micropkg/test_micropkg_pull.py +++ b/tests/framework/cli/micropkg/test_micropkg_pull.py @@ -17,6 +17,14 @@ PIPELINE_NAME = "my_pipeline" +@pytest.fixture +def temp_dir_with_context_manager(tmp_path): + mock_temp_dir = Mock() + mock_temp_dir.__enter__ = Mock(return_value=tmp_path) + mock_temp_dir.__exit__ = Mock(return_value=None) + return mock_temp_dir + + def call_pipeline_create(cli, metadata, pipeline_name=PIPELINE_NAME): result = CliRunner().invoke( cli, ["pipeline", "create", pipeline_name], obj=metadata @@ -552,6 +560,7 @@ def test_pull_from_pypi( env, alias, fake_metadata, + temp_dir_with_context_manager, ): """ Test for pulling a valid sdist file from pypi. @@ -581,7 +590,7 @@ def test_pull_from_pypi( python_call_mock = mocker.patch("kedro.framework.cli.micropkg.python_call") mocker.patch( "kedro.framework.cli.micropkg.tempfile.TemporaryDirectory", - return_value=tmp_path, + return_value=temp_dir_with_context_manager, ) # Mock needed to avoid an error when build.util.project_wheel_metadata @@ -639,7 +648,12 @@ def get_all(self, name, failobj=None): assert actual_test_files == expected_test_files def test_invalid_pull_from_pypi( - self, fake_project_cli, mocker, tmp_path, fake_metadata + self, + fake_project_cli, + mocker, + tmp_path, + fake_metadata, + temp_dir_with_context_manager, ): """ Test for pulling package from pypi, and it cannot be found. @@ -654,7 +668,7 @@ def test_invalid_pull_from_pypi( ) mocker.patch( "kedro.framework.cli.micropkg.tempfile.TemporaryDirectory", - return_value=tmp_path, + return_value=temp_dir_with_context_manager, ) invalid_pypi_name = "non_existent" @@ -679,7 +693,12 @@ def test_invalid_pull_from_pypi( assert pypi_error_message in result.stdout def test_pull_from_pypi_more_than_one_sdist_file( - self, fake_project_cli, mocker, tmp_path, fake_metadata + self, + fake_project_cli, + mocker, + tmp_path, + fake_metadata, + temp_dir_with_context_manager, ): """ Test for pulling a sdist file with `pip download`, but there are more than one sdist @@ -695,7 +714,7 @@ def test_pull_from_pypi_more_than_one_sdist_file( mocker.patch("kedro.framework.cli.micropkg.python_call") mocker.patch( "kedro.framework.cli.micropkg.tempfile.TemporaryDirectory", - return_value=tmp_path, + return_value=temp_dir_with_context_manager, ) result = CliRunner().invoke( fake_project_cli, ["micropkg", "pull", PIPELINE_NAME], obj=fake_metadata @@ -705,7 +724,12 @@ def test_pull_from_pypi_more_than_one_sdist_file( assert "Error: More than 1 or no sdist files found:" in result.output def test_pull_unsupported_protocol_by_fsspec( - self, fake_project_cli, fake_metadata, tmp_path, mocker + self, + fake_project_cli, + fake_metadata, + tmp_path, + mocker, + temp_dir_with_context_manager, ): protocol = "unsupported" exception_message = f"Protocol not known: {protocol}" @@ -718,7 +742,7 @@ def test_pull_unsupported_protocol_by_fsspec( ) mocker.patch( "kedro.framework.cli.micropkg.tempfile.TemporaryDirectory", - return_value=tmp_path, + return_value=temp_dir_with_context_manager, ) result = CliRunner().invoke( diff --git a/tests/test_import.py b/tests/test_import.py index 6dc9da4df4..511b6d19b4 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -4,8 +4,8 @@ def test_import_kedro_with_no_official_support_raise_error(mocker): - """Test importing kedro with python>=3.13 should fail""" - mocker.patch("kedro.sys.version_info", (3, 13)) + """Test importing kedro with python>=3.14 should fail""" + mocker.patch("kedro.sys.version_info", (3, 14)) # We use the parent class to avoid issues with `exec_module` with pytest.raises(UserWarning) as excinfo: @@ -15,8 +15,8 @@ def test_import_kedro_with_no_official_support_raise_error(mocker): def test_import_kedro_with_no_official_support_emits_warning(mocker): - """Test importing kedro python>=3.13 and controlled warnings should work""" - mocker.patch("kedro.sys.version_info", (3, 13)) + """Test importing kedro python>=3.14 and controlled warnings should work""" + mocker.patch("kedro.sys.version_info", (3, 14)) mocker.patch("kedro.sys.warnoptions", ["default:Kedro is not yet fully compatible"]) # We use the parent class to avoid issues with `exec_module`