Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add official support for Python 3.13 #4328

Merged
merged 15 commits into from
Nov 15, 2024
6 changes: 3 additions & 3 deletions .github/workflows/all-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-only-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Major features and improvements
* Implemented dict-like interface for `KedroDataCatalog`.
* Add official support for Python 3.13.
ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved
* 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`.

Expand Down
2 changes: 1 addition & 1 deletion kedro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
38 changes: 31 additions & 7 deletions tests/framework/cli/micropkg/test_micropkg_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


ravi-kumar-pilla marked this conversation as resolved.
Show resolved Hide resolved
def call_pipeline_create(cli, metadata, pipeline_name=PIPELINE_NAME):
result = CliRunner().invoke(
cli, ["pipeline", "create", pipeline_name], obj=metadata
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}"
Expand All @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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`
Expand Down