Skip to content

Commit

Permalink
Add deprecation warnings to top-level use of layer in catalog definit…
Browse files Browse the repository at this point in the history
…ion (#2964)

* add deprecation

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

* lint

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

* Use FutureWarning

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

* changes based on review

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

* add link to docs

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>

* Update RELEASE.md

Co-authored-by: Jo Stichbury <jo_stichbury@mckinsey.com>

---------

Signed-off-by: SajidAlamQB <90610031+SajidAlamQB@users.noreply.github.com>
Co-authored-by: Jo Stichbury <jo_stichbury@mckinsey.com>
  • Loading branch information
SajidAlamQB and stichbury authored Aug 25, 2023
1 parent e86508e commit b3637fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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

0 comments on commit b3637fb

Please sign in to comment.