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 warnings to top-level use of layer in catalog definition #2964

Merged
merged 9 commits into from
Aug 25, 2023
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
| `AbstractDataset` | `AbstractDataSet` | `kedro.io.core` |
| `AbstractVersionedDataset` | `AbstractVersionedDataSet` | `kedro.io.core` |

* Using the `layer` attribute at the top level is deprecated; it will be removed in Kedro version 0.19.0. Please move `layer` inside the `metadata` -> `kedro-viz` attributes.

# Release 0.18.12

## Major features and improvements
Expand Down
11 changes: 11 additions & 0 deletions kedro/io/data_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ class to be loaded is specified with the key ``type`` and their
dataset_patterns[ds_name] = ds_config

else:
# Check if 'layer' attribute is defined at the top level
if "layer" in ds_config:
import warnings

warnings.warn(
"Defining the 'layer' attribute at the top level is deprecated "
"and will be removed in Kedro 0.19.0. Please move 'layer' inside the 'metadata' -> "
"'kedro-viz' attributes. See https://docs.kedro.org/en/latest/visualisation/kedro"
"-viz_visualisation.html#visualise-layers for more information.",
FutureWarning,
)
ds_layer = ds_config.pop("layer", None)
if ds_layer is not None:
layers[ds_layer].add(ds_name)
Expand Down