Skip to content

Commit

Permalink
Move KedroStarterSpec to framework __init__
Browse files Browse the repository at this point in the history
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
  • Loading branch information
noklam committed Jun 22, 2022
1 parent 1de52d1 commit 611eedb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion features/steps/test_plugin/plugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Dummy plugin with simple hook implementations."""
import logging

from kedro.framework.cli.starters import KedroStarterSpec
from kedro.framework import KedroStarterSpec
from kedro.framework.hooks import hook_impl

logger = logging.getLogger(__name__)
Expand Down
22 changes: 22 additions & 0 deletions kedro/framework/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
"""``kedro.framework`` provides Kedro's framework components """
from typing import Optional

from attr import define, field


@define(order=True)
class KedroStarterSpec: # pylint: disable=too-few-public-methods
"""Specification of custom kedro starter template
Args:
alias: alias of the starter which shows up on `kedro starter list` and is used
by the starter argument of `kedro new`
template_path: path to a directory or a URL to a remote VCS repository supported
by `cookiecutter`
directory: optional directory inside the repository where the starter resides.
origin: reserved field used by kedro internally to determine where the starter
comes from, users do not need to provide this field.
"""

alias: str
template_path: str
directory: Optional[str] = None
origin: Optional[str] = field(init=False)
22 changes: 1 addition & 21 deletions kedro/framework/cli/starters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

import click
import yaml
from attrs import define, field

import kedro
from kedro import __version__ as version
from kedro.framework import KedroStarterSpec
from kedro.framework.cli.utils import (
CONTEXT_SETTINGS,
KedroCliError,
Expand All @@ -33,26 +33,6 @@
TEMPLATE_PATH = KEDRO_PATH / "templates" / "project"
_STARTERS_REPO = "git+https://github.com/kedro-org/kedro-starters.git"


@define(order=True)
class KedroStarterSpec: # pylint: disable=too-few-public-methods
"""Specification of custom kedro starter template
Args:
alias: alias of the starter which shows up on `kedro starter list` and is used
by the starter argument of `kedro new`
template_path: path to a directory or a URL to a remote VCS repository supported
by `cookiecutter`
directory: optional directory inside the repository where the starter resides.
origin: reserved field used by kedro internally to determine where the starter
comes from, users do not need to provide this field.
"""

alias: str
template_path: str
directory: Optional[str] = None
origin: Optional[str] = field(init=False)


_OFFICIAL_STARTER_SPECS = [
KedroStarterSpec("astro-airflow-iris", _STARTERS_REPO, "astro-airflow-iris"),
# The `astro-iris` was renamed to `astro-airflow-iris`, but old (external)
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/cli/test_starters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from kedro.framework.cli.starters import (
_OFFICIAL_STARTER_SPECS,
TEMPLATE_PATH,
KedroStarterSpec,
)
from kedro.framework import KedroStarterSpec

FILES_IN_TEMPLATE = 32

Expand Down

0 comments on commit 611eedb

Please sign in to comment.