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 deprecation warning for TemplatedConfigLoader and ConfigLoader #2840

Merged
merged 4 commits into from
Jul 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions kedro/framework/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import subprocess
import sys
import traceback
import warnings
from copy import deepcopy
from pathlib import Path
from typing import Any, Iterable

import click

from kedro import __version__ as kedro_version
from kedro.config import ConfigLoader, MissingConfigException
from kedro.config import ConfigLoader, MissingConfigException, TemplatedConfigLoader
from kedro.framework.context import KedroContext
from kedro.framework.context.context import _convert_paths_to_absolute_posix
from kedro.framework.hooks import _create_hook_manager
Expand Down Expand Up @@ -262,7 +263,14 @@ def load_context(self) -> KedroContext:
env = self.store.get("env")
extra_params = self.store.get("extra_params")
config_loader = self._get_config_loader()

if isinstance(config_loader, (ConfigLoader, TemplatedConfigLoader)):
warnings.warn(
f"{type(config_loader).__name__} will be deprecated in Kedro 0.19."
f" Please use the OmegaConfigLoader instead. To consult"
f" the documentation for OmegaConfigLoader, see here:"
f" https://docs.kedro.org/en/stable/configuration/advanced_configuration.html#omegaconfigloader", # pylint: disable=line-too-long
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f"{type(config_loader).__name__} will be deprecated in Kedro 0.19."
f" Please use the OmegaConfigLoader instead. To consult"
f" the documentation for OmegaConfigLoader, see here:"
f" https://docs.kedro.org/en/stable/configuration/advanced_configuration.html#omegaconfigloader", # pylint: disable=line-too-long
f"{type(config_loader).__name__} will be deprecated in Kedro 0.19."
f" Please use the OmegaConfigLoader instead."
f" To import OmegaConfigLoader use: 'from kedro.config import OmegaConfigLoader'."
f" Consult the documentation for OmegaConfigLoader at:"
f" https://docs.kedro.org/en/stable/configuration/"
f"advanced_configuration.html#omegaconfigloader",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions (feel free to use or ignore):

  • Maybe just split the link into multiple lines.
  • Add the new import line for OmegaConfigLoader for convenience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sajid, I split the link into multiple lines but I think the import line will make it too verbose. The link to the OmegaConfigLoader docs has this right on top. :)

FutureWarning,
)
context_class = settings.CONTEXT_CLASS
context = context_class(
package_name=self._package_name,
Expand Down