Skip to content

Commit

Permalink
[KED-2926] Remove decorators (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorena Bălan authored Nov 8, 2021
1 parent e06f14b commit 357d56d
Show file tree
Hide file tree
Showing 24 changed files with 13 additions and 826 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* Removed the `kedro install` command in favour of using `pip install -r src/requirements.txt` to install project dependencies.
* The dataset `networkx.NetworkXDataSet` has been renamed to `networkx.JSONDataSet`.
* Removed the `config_loader` property from `KedroContext`.
* Removed decorator API from `Node` and `Pipeline`, as well as the modules `kedro.extras.decorators` and `kedro.pipeline.decorators`.

## Thanks for supporting contributions

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@
"kedro.config",
"kedro.extras.datasets",
"kedro.extras.logging",
"kedro.extras.decorators",
"kedro.extras.transformers",
]

Expand Down
4 changes: 1 addition & 3 deletions docs/source/07_extend_kedro/01_common_use_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ The execution timeline of a Kedro pipeline can be thought of as a sequence of ac

At different points in the lifecycle of these components, you may want to add extra behaviour. For example, you could add extra computation for profiling purposes _before_ and _after_ a node runs or _before_ and _after_ the I/O actions of a dataset, namely the `load` and `save` actions.

Before Kedro 0.17.0, we added a few different APIs to allow you to extend Kedro's behaviour. For example, to allow extra behaviour _before_ and _after_ a node runs, we introduced the [decorators](07_decorators.md) API. Similarly, to allow extra behaviour _before_ and _after_ dataset I/O, we introduced the [transformers](06_transformers.md) API.

While we addressed some immediate use cases, we have since decided to provide just one, single way to extend Kedro's execution timeline: Hooks. So, from Kedro version 0.17.0, we now deprecate decorators and transformers in favour of [Hooks](./02_hooks.md), which will be the recommended approach when you need to extend Kedro's execution timeline.
This can now achieved by using [Hooks](./02_hooks.md), to define the extra behaviour and at which point in the execution timeline it should be injected.

## Use Case 2: How to integrate Kedro with additional data sources

Expand Down
4 changes: 1 addition & 3 deletions docs/source/07_extend_kedro/02_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ where `<plugin_name>` is the name of an installed plugin for which the auto-regi

### Use Hooks to extend a node's behaviour

Prior to Kedro 0.16, to add extra behaviour before and after a node's execution, we recommended using [decorators](07_decorators.md) on individual nodes. We also exposed a convenience method to apply decorators to [all nodes in a `Pipeline`](07_decorators.md#how-to-apply-a-decorator-to-nodes).

However, after the introduction of Hooks in 0.16, this capability is readily available through the [`before_node_run` and `after_node_run` Hooks](/kedro.framework.hooks.specs.NodeSpecs). Furthermore, you can apply extra behaviour to not only an individual node or an entire Kedro pipeline, but also to a _subset_ of nodes based on their tags or namespaces. For example, let's say we want to add the following extra behaviours to a node:
You can add extra behaviour before and after a node's execution by using the [`before_node_run` and `after_node_run` Hooks](/kedro.framework.hooks.specs.NodeSpecs). Furthermore, you can apply extra behaviour to not only an individual node or an entire Kedro pipeline, but also to a _subset_ of nodes based on their tags or namespaces. For example, let's say we want to add the following extra behaviours to a node:

```python
from kedro.pipeline.node import Node
Expand Down
126 changes: 0 additions & 126 deletions docs/source/07_extend_kedro/07_decorators.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/15_api_docs/kedro.pipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ kedro.pipeline

.. rubric:: Modules

.. autosummary::
:toctree:
:recursive:

kedro.pipeline.decorators

.. rubric:: Exceptions

.. autosummary::
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ Welcome to Kedro's documentation!
07_extend_kedro/04_plugins
07_extend_kedro/05_create_kedro_starters
07_extend_kedro/06_transformers
07_extend_kedro/07_decorators


.. toctree::
Expand Down
4 changes: 2 additions & 2 deletions kedro/extras/datasets/geopandas/geojson_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def __init__(
Note: `http(s)` doesn't support versioning.
load_args: GeoPandas options for loading GeoJSON files.
Here you can find all available arguments:
https://geopandas.org/docs/reference/api/geopandas.read_file.html#geopandas.read_file
https://geopandas.org/en/stable/docs/reference/api/geopandas.read_file.html
save_args: GeoPandas options for saving geojson files.
Here you can find all available arguments:
https://geopandas.org/docs/reference/api/geopandas.GeoDataFrame.to_file.html
https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.to_file.html
The default_save_arg driver is 'GeoJSON', all others preserved.
version: If specified, should be an instance of
``kedro.io.core.Version``. If its ``load`` attribute is
Expand Down
44 changes: 0 additions & 44 deletions kedro/extras/decorators/README.md

This file was deleted.

1 change: 0 additions & 1 deletion kedro/extras/decorators/__init__.py

This file was deleted.

58 changes: 0 additions & 58 deletions kedro/extras/decorators/memory_profiler.py

This file was deleted.

59 changes: 0 additions & 59 deletions kedro/extras/decorators/retry_node.py

This file was deleted.

Loading

0 comments on commit 357d56d

Please sign in to comment.