Repository: Galileo-Galilei/kedro-mlflow (language: python)

Issue:
Migrate to kedro>=0.17.0
## Description
The new `kedro==0.17.0` version is out and comes with [its share of breaking changes](https://github.com/quantumblacklabs/kedro/blob/master/RELEASE.md#release-0170).

## Context
It is important to keep the plugin up to date with kedro to avoid deprecation and increase adoption. It will also enable to adopt some highly demanded feature (e.g. #92 and maybe #124)

## Possible Implementation

Most of the breaking changes comes from the `context` which is now contained in a KedroSession object. It must be updated all over the codebase. 

The release notes must be read in details to see if some other changes are needed.

## TODO

- [x] Bump requirements
- [x] Change the config_dir fixture accordingly to the new template for the tests
- [x] utils:
  - [x] Update ``_is_kedro_project`` to check for existence of a "[tool.kedro]" section in pyproject.toml. See [kedro ProjectMetaData _is_project()](https://github.com/quantumblacklabs/kedro/blob/1bb5f4be6fc4e6ef7a5a9480131cbce4582385c9/kedro/framework/startup.py)
  - [x] Update ``_get_project_globals`` to retrieve info from pyproject.toml See [kedro ProjectMetaData _get_project_metadata()](https://github.com/quantumblacklabs/kedro/blob/1bb5f4be6fc4e6ef7a5a9480131cbce4582385c9/kedro/framework/startup.py)
- [x] config:
  - [x] Update ``validate_uri`` which should dynamically get project_path from KedroSession
  - [x] Update  ``setup`` to avoid avoid passing context as argument (retrieve from KedroSession inside the function)
- [x] cli: 
  - [x] Replace call to `load_context()` by `KedroSession.create()`
  - [x] Update to the new utility to retrieve metadata
- [x] hooks: 
  - [x] Replace calls to `load_context()` by `get_current_session()`
- [x] Update all tests to replace calls to `load_context()` by `KedroSession.create()`
- [ ] Update documentation
Migrate to kedro>=0.17.0
## Description
The new `kedro==0.17.0` version is out and comes with [its share of breaking changes](https://github.com/quantumblacklabs/kedro/blob/master/RELEASE.md#release-0170).

## Context
It is important to keep the plugin up to date with kedro to avoid deprecation and increase adoption. It will also enable to adopt some highly demanded feature (e.g. #92 and maybe #124)

## Possible Implementation

Most of the breaking changes comes from the `context` which is now contained in a KedroSession object. It must be updated all over the codebase. 

The release notes must be read in details to see if some other changes are needed.

## TODO

- [x] Bump requirements
- [x] Change the config_dir fixture accordingly to the new template for the tests
- [x] utils:
  - [x] Update ``_is_kedro_project`` to check for existence of a "[tool.kedro]" section in pyproject.toml. See [kedro ProjectMetaData _is_project()](https://github.com/quantumblacklabs/kedro/blob/1bb5f4be6fc4e6ef7a5a9480131cbce4582385c9/kedro/framework/startup.py)
  - [x] Update ``_get_project_globals`` to retrieve info from pyproject.toml See [kedro ProjectMetaData _get_project_metadata()](https://github.com/quantumblacklabs/kedro/blob/1bb5f4be6fc4e6ef7a5a9480131cbce4582385c9/kedro/framework/startup.py)
- [x] config:
  - [x] Update ``validate_uri`` which should dynamically get project_path from KedroSession
  - [x] Update  ``setup`` to avoid avoid passing context as argument (retrieve from KedroSession inside the function)
- [x] cli: 
  - [x] Replace call to `load_context()` by `KedroSession.create()`
  - [x] Update to the new utility to retrieve metadata
- [x] hooks: 
  - [x] Replace calls to `load_context()` by `get_current_session()`
- [x] Update all tests to replace calls to `load_context()` by `KedroSession.create()`
- [ ] Update documentation


Discussion / hints:
If anyone wants to try the version with 0.17 (@arnaldog12, sorry to ping directly but if you want to be a beta tester it will help ;p), feel free to install directly the plugin from the feature/compatibility-0.17 branch, it should already work and will be released within few weeks.

```console
pip install --upgrade git+https://github.com/Galileo-Galilei/kedro-mlflow.git@feature/compatibility-0.17
```

Note that it does not work with kedro==0.17.1 but only with kedro==0.17.0 since the kedro core team made a breaking change between the two patch releases. I will update immediately after I release this version.
Hi, @Galileo-Galilei 
I'll try it in the next few days. Thanks!
Hi, @Galileo-Galilei 
I have just tested the `kedro-mlflow` version you sent to me in an existing project. It worked very well!
Good job! Congrats on that!

I can also take a look at the PR if you want. Just let me know.
Best regards,
Thank you for the test! It would be very nice if you find time to review the code, the more eyes on it, the better the result! (note that I am still making some minor updates to the PR to improve docs and tests, but the core code should be already quite stable ).
I reopen the issue for future works, but currrently: 

- "kedro-mlflow==0.6.0" has been published on PyPI today, and is fully compatible with kedro==0.17.0
- I've just published on master a version which is compatible with kedro>=0.17.1, so anyone who is interested can install directly from github with: 

```console
pip install --upgrade git+https://github.com/Galileo-Galilei/kedro-mlflow.git
```

Any beta tester is warmly welcome!

If anyone wants to try the version with 0.17 (@arnaldog12, sorry to ping directly but if you want to be a beta tester it will help ;p), feel free to install directly the plugin from the feature/compatibility-0.17 branch, it should already work and will be released within few weeks.

```console
pip install --upgrade git+https://github.com/Galileo-Galilei/kedro-mlflow.git@feature/compatibility-0.17
```

Note that it does not work with kedro==0.17.1 but only with kedro==0.17.0 since the kedro core team made a breaking change between the two patch releases. I will update immediately after I release this version.
Hi, @Galileo-Galilei 
I'll try it in the next few days. Thanks!
Hi, @Galileo-Galilei 
I have just tested the `kedro-mlflow` version you sent to me in an existing project. It worked very well!
Good job! Congrats on that!

I can also take a look at the PR if you want. Just let me know.
Best regards,
Thank you for the test! It would be very nice if you find time to review the code, the more eyes on it, the better the result! (note that I am still making some minor updates to the PR to improve docs and tests, but the core code should be already quite stable ).
I reopen the issue for future works, but currrently: 

- "kedro-mlflow==0.6.0" has been published on PyPI today, and is fully compatible with kedro==0.17.0
- I've just published on master a version which is compatible with kedro>=0.17.1, so anyone who is interested can install directly from github with: 

```console
pip install --upgrade git+https://github.com/Galileo-Galilei/kedro-mlflow.git
```

Any beta tester is warmly welcome!


Fix patch:
diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml
index 06c31a73..1dc0e871 100644
--- a/.github/workflows/prepare-release.yml
+++ b/.github/workflows/prepare-release.yml
@@ -44,7 +44,7 @@ jobs:
         git push -u origin release-${{ steps.bump_version.outputs.package_version }}
     - name: Commit the changes
       run: |
-        git commit -am "FIX #${{ steps.open_pr.outputs.pull_request_number }}  - Bump version and CHANGELOG for release ${{ steps.bump_version.outputs.package_version }}"
+        git commit -am "Bump version and CHANGELOG for release ${{ steps.bump_version.outputs.package_version }}"
         git push
     - name: Open a PR to merge the release to master
       id: open_pr
@@ -56,3 +56,7 @@ jobs:
         PULL_REQUEST_TITLE: "Release ${{ steps.bump_version.outputs.package_version }}"
         PULL_REQUEST_BODY: "Bump version and CHANGELOG for next release."
         PULL_REQUEST_ASSIGNEES: "${{ github.repository_owner }}"
+    - name: Change the comit message to add PR number
+      run: |
+        git commit -a --amend -m "FIX #${{ steps.open_pr.outputs.pull_request_number }}  - Bump version and CHANGELOG for release ${{ steps.bump_version.outputs.package_version }}"
+        git push -f
diff --git a/requirements.txt b/requirements.txt
index c518e513..8cfb724f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
+kedro>=0.17.1, <0.18.0
 mlflow>=1.0.0, <2.0.0
-kedro>=0.17.1,<0.18.0  # seems to be broken with kedro==0.17.1
diff --git a/setup.py b/setup.py
index 87d0c5b4..b2d9e44b 100644
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def _parse_requirements(path, encoding="utf-8"):
         "tests": [
             "pytest>=5.4.0, <7.0.0",
             "pytest-cov>=2.8.0, <3.0.0",
-            "pytest-lazy-fixture>=0.7.0, <1.0.0",
+            "pytest-lazy-fixture>=0.6.0, <1.0.0",
             "pytest-mock>=3.1.0, <4.0.0",
             "scikit-learn>=0.23.0, <0.25.0",
             "flake8==3.8.4",  # ensure consistency with pre-commit


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index ea08024f..5b66b120 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,7 +4,7 @@
 import pytest
 from cookiecutter.main import cookiecutter
 from kedro import __version__ as kedro_version
-from kedro.framework.cli.cli import TEMPLATE_PATH
+from kedro.framework.cli.starters import TEMPLATE_PATH
 from kedro.framework.hooks.manager import get_hook_manager
 from kedro.framework.session.session import _deactivate_session
 
diff --git a/tests/framework/hooks/test_pipeline_hook.py b/tests/framework/hooks/test_pipeline_hook.py
index 2ae71cd8..5f85afc3 100644
--- a/tests/framework/hooks/test_pipeline_hook.py
+++ b/tests/framework/hooks/test_pipeline_hook.py
@@ -713,18 +713,16 @@ class DummyContextWithHook(KedroContext):
 
             hooks = (MlflowPipelineHook(),)
 
-            def _get_pipelines(self):
-                return {
-                    "__default__": Pipeline(
-                        [
-                            node(
-                                func=failing_node,
-                                inputs=None,
-                                outputs="fake_output",
-                            )
-                        ]
-                    )
-                }
+            def _get_pipeline(self, name: str = None) -> Pipeline:
+                return Pipeline(
+                    [
+                        node(
+                            func=failing_node,
+                            inputs=None,
+                            outputs="fake_output",
+                        )
+                    ]
+                )
 
         with pytest.raises(ValueError):
             failing_context = DummyContextWithHook(