diff --git a/kedrojson/plugin.py b/kedrojson/plugin.py new file mode 100644 index 0000000..97715f0 --- /dev/null +++ b/kedrojson/plugin.py @@ -0,0 +1,17 @@ +import click +from kedro.framework.session import KedroSession + + +@click.group(name="JSON") +def commands(): + """Kedro plugin for printing the pipeline in JSON format""" + pass + + +@commands.command() +@click.pass_obj +def to_json(metadata): + """Display the pipeline in JSON format""" + session = KedroSession.create(metadata.package_name) + context = session.load_context() + print(context.pipeline.to_json()) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fe9da45 --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup + +with open("README.md") as f: + README = f.read() + +setup( + entry_points={"kedro.plugins": ["kedrojson = kedrojson.plugin:commands"]}, +) diff --git a/src/kedro_dvc.py b/src/kedro_dvc.py new file mode 100644 index 0000000..97715f0 --- /dev/null +++ b/src/kedro_dvc.py @@ -0,0 +1,17 @@ +import click +from kedro.framework.session import KedroSession + + +@click.group(name="JSON") +def commands(): + """Kedro plugin for printing the pipeline in JSON format""" + pass + + +@commands.command() +@click.pass_obj +def to_json(metadata): + """Display the pipeline in JSON format""" + session = KedroSession.create(metadata.package_name) + context = session.load_context() + print(context.pipeline.to_json())