From 9a453823e2195f997fe97ad2525ef95f47815bbd Mon Sep 17 00:00:00 2001 From: Ankita Katiyar Date: Mon, 23 Dec 2024 10:55:11 +0000 Subject: [PATCH 1/5] Remove branch check when not a starter Signed-off-by: Ankita Katiyar --- kedro/framework/cli/starters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/kedro/framework/cli/starters.py b/kedro/framework/cli/starters.py index fbafbb56c1..48299e31df 100644 --- a/kedro/framework/cli/starters.py +++ b/kedro/framework/cli/starters.py @@ -345,7 +345,6 @@ def new( # noqa: PLR0913 checkout = _select_checkout_branch_for_cookiecutter(checkout) elif starter_alias is not None: template_path = starter_alias - checkout = _select_checkout_branch_for_cookiecutter(checkout) else: template_path = str(TEMPLATE_PATH) From 2b8e9ad9fccb320ea5795c7a9b3da26d59e4f512 Mon Sep 17 00:00:00 2001 From: Ankita Katiyar Date: Mon, 23 Dec 2024 11:22:36 +0000 Subject: [PATCH 2/5] fix docslink + tests Signed-off-by: Ankita Katiyar --- .../deployment/databricks/databricks_deployment_workflow.md | 2 +- tests/framework/cli/test_starters.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/source/deployment/databricks/databricks_deployment_workflow.md b/docs/source/deployment/databricks/databricks_deployment_workflow.md index 2ebe21c48e..16ecd04ba0 100644 --- a/docs/source/deployment/databricks/databricks_deployment_workflow.md +++ b/docs/source/deployment/databricks/databricks_deployment_workflow.md @@ -253,7 +253,7 @@ The Databricks API enables you to programmatically interact with Databricks serv 1. [Set up your Kedro project for deployment on Databricks](#set-up-your-project-for-deployment-to-databricks) 2. Create a JSON file containing your job's configuration. -3. Use the Jobs API's [`/create` endpoint](https://docs.databricks.com/workflows/jobs/jobs-api-updates.html#create) to create a new job. +3. Use the Jobs API's [`/create` endpoint](https://docs.databricks.com/en/reference/jobs-2.0-api.html#create) to create a new job. 4. Use the Jobs API's [`/runs/submit` endpoint](https://docs.databricks.com/workflows/jobs/jobs-api-updates.html#runs-submit) to run your newly created job. ### How to use the Databricks CLI to automatically deploy a Kedro project diff --git a/tests/framework/cli/test_starters.py b/tests/framework/cli/test_starters.py index 7f2641da10..87c434dfd1 100644 --- a/tests/framework/cli/test_starters.py +++ b/tests/framework/cli/test_starters.py @@ -861,9 +861,6 @@ def test_git_repo(self, fake_kedro_cli, mock_determine_repo_dir, mock_cookiecutt "template": "git+https://github.com/fake/fake.git", "directory": None, } - starters_version = mock_determine_repo_dir.call_args[1].pop("checkout", None) - - assert starters_version in [version, "main"] assert kwargs.items() <= mock_determine_repo_dir.call_args[1].items() del kwargs["directory"] assert kwargs.items() <= mock_cookiecutter.call_args[1].items() @@ -910,9 +907,6 @@ def test_git_repo_custom_directory( "template": "git+https://github.com/fake/fake.git", "directory": "my_directory", } - starters_version = mock_determine_repo_dir.call_args[1].pop("checkout", None) - - assert starters_version in [version, "main"] assert kwargs.items() <= mock_determine_repo_dir.call_args[1].items() assert kwargs.items() <= mock_cookiecutter.call_args[1].items() From afeef40eddeaf99829fcf925b639d348c83bd3a6 Mon Sep 17 00:00:00 2001 From: Ankita Katiyar Date: Mon, 23 Dec 2024 12:37:44 +0000 Subject: [PATCH 3/5] fix docslink + tests Signed-off-by: Ankita Katiyar --- .../databricks_deployment_workflow.md | 2 +- tests/framework/cli/test_starters.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/source/deployment/databricks/databricks_deployment_workflow.md b/docs/source/deployment/databricks/databricks_deployment_workflow.md index 16ecd04ba0..cf5ede1589 100644 --- a/docs/source/deployment/databricks/databricks_deployment_workflow.md +++ b/docs/source/deployment/databricks/databricks_deployment_workflow.md @@ -254,7 +254,7 @@ The Databricks API enables you to programmatically interact with Databricks serv 1. [Set up your Kedro project for deployment on Databricks](#set-up-your-project-for-deployment-to-databricks) 2. Create a JSON file containing your job's configuration. 3. Use the Jobs API's [`/create` endpoint](https://docs.databricks.com/en/reference/jobs-2.0-api.html#create) to create a new job. -4. Use the Jobs API's [`/runs/submit` endpoint](https://docs.databricks.com/workflows/jobs/jobs-api-updates.html#runs-submit) to run your newly created job. +4. Use the Jobs API's [`/runs/submit` endpoint](https://docs.databricks.com/en/reference/jobs-2.0-api.html#runs-submit) to run your newly created job. ### How to use the Databricks CLI to automatically deploy a Kedro project diff --git a/tests/framework/cli/test_starters.py b/tests/framework/cli/test_starters.py index 87c434dfd1..efc4683b4e 100644 --- a/tests/framework/cli/test_starters.py +++ b/tests/framework/cli/test_starters.py @@ -936,6 +936,26 @@ def test_invalid_starter(self, fake_kedro_cli): assert result.exit_code != 0 assert "Kedro project template not found at invalid" in result.output + def test_invalid_starter_tag_suggestions(self, fake_kedro_cli): + result = CliRunner().invoke( + fake_kedro_cli, + [ + "new", + "-v", + "--starter", + "https://github.com/kedro-org/kedro-starters.git", + "--directory", + "spaceflights-pandas", + "--checkout", + "invalid", + ], + input=_make_cli_prompt_input(), + ) + assert result.exit_code != 0 + assert ( + "Specified tag invalid. The following tags are available:" in result.output + ) + @pytest.mark.parametrize( "starter, repo", [ From 3eae2ea6cde72756331e66f183393e35a5f73864 Mon Sep 17 00:00:00 2001 From: Ankita Katiyar Date: Mon, 23 Dec 2024 16:00:26 +0000 Subject: [PATCH 4/5] no cover Signed-off-by: Ankita Katiyar --- kedro/framework/cli/starters.py | 2 +- tests/framework/cli/test_starters.py | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/kedro/framework/cli/starters.py b/kedro/framework/cli/starters.py index 48299e31df..bdbfb1e512 100644 --- a/kedro/framework/cli/starters.py +++ b/kedro/framework/cli/starters.py @@ -519,7 +519,7 @@ def _get_available_tags(template_path: str) -> list: # tags: ['/tags/version', '/tags/version^{}'] # unique_tags: {'version'} - except git.GitCommandError: + except git.GitCommandError: # pragma: no cover return [] return sorted(unique_tags) diff --git a/tests/framework/cli/test_starters.py b/tests/framework/cli/test_starters.py index efc4683b4e..87c434dfd1 100644 --- a/tests/framework/cli/test_starters.py +++ b/tests/framework/cli/test_starters.py @@ -936,26 +936,6 @@ def test_invalid_starter(self, fake_kedro_cli): assert result.exit_code != 0 assert "Kedro project template not found at invalid" in result.output - def test_invalid_starter_tag_suggestions(self, fake_kedro_cli): - result = CliRunner().invoke( - fake_kedro_cli, - [ - "new", - "-v", - "--starter", - "https://github.com/kedro-org/kedro-starters.git", - "--directory", - "spaceflights-pandas", - "--checkout", - "invalid", - ], - input=_make_cli_prompt_input(), - ) - assert result.exit_code != 0 - assert ( - "Specified tag invalid. The following tags are available:" in result.output - ) - @pytest.mark.parametrize( "starter, repo", [ From cab4cbbe162d1820cc5ac26c697440e0383d971a Mon Sep 17 00:00:00 2001 From: Ankita Katiyar Date: Thu, 2 Jan 2025 14:53:12 +0000 Subject: [PATCH 5/5] Add release notes Signed-off-by: Ankita Katiyar --- RELEASE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE.md b/RELEASE.md index 0cc0fdf013..f3651ec992 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,6 +5,7 @@ ## Bug fixes and other changes * Added validation to ensure dataset versions consistency across catalog. +* Fixed a bug in project creation when using a custom starter template offline. ## Breaking changes to the API ## Documentation changes