Skip to content

Commit

Permalink
feat: began plugin creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahCFisher committed Feb 14, 2022
1 parent 99a3f80 commit dd13bd1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions kedrojson/plugin.py
Original file line number Diff line number Diff line change
@@ -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())
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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"]},
)
17 changes: 17 additions & 0 deletions src/kedro_dvc.py
Original file line number Diff line number Diff line change
@@ -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())

0 comments on commit dd13bd1

Please sign in to comment.