Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation notice to archived starters #3173

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
## Upcoming deprecations for Kedro 0.19.0
* All dataset classes will be removed from the core Kedro repository (`kedro.extras.datasets`). Install and import them from the [`kedro-datasets`](https://github.com/kedro-org/kedro-plugins/tree/main/kedro-datasets) package instead.
* All dataset classes ending with `DataSet` are deprecated and will be removed in Kedro `0.19.0` and `kedro-datasets` `2.0.0`. Instead, use the updated class names ending with `Dataset`.
* The starters `pandas-iris`, `pyspark-iris`, `pyspark`, and `standalone-datacatalog` are deprecated and will be archived in Kedro 0.19.0.
* `PartitionedDataset` and `IncrementalDataset` have been moved to `kedro-datasets` and will be removed in Kedro `0.19.0`. Install and import them from the [`kedro-datasets`](https://github.com/kedro-org/kedro-plugins/tree/main/kedro-datasets) package instead.

## Community contributions
Expand Down
35 changes: 32 additions & 3 deletions kedro/framework/cli/starters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shutil
import stat
import tempfile
import warnings
from collections import OrderedDict
from itertools import groupby
from pathlib import Path
Expand All @@ -20,6 +21,7 @@
from attrs import define, field

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

_DEPRECATED_STARTERS = [
"pandas-iris",
"pyspark-iris",
"pyspark",
"standalone-datacatalog",
]


@define(order=True)
class KedroStarterSpec: # noqa: too-few-public-methods
Expand Down Expand Up @@ -152,10 +161,14 @@ def _starter_spec_to_dict(
"""Convert a dictionary of starters spec to a nicely formatted dictionary"""
format_dict: dict[str, dict[str, str]] = {}
for alias, spec in starter_specs.items():
format_dict[alias] = {} # Each dictionary represent 1 starter
format_dict[alias]["template_path"] = spec.template_path
if alias in _DEPRECATED_STARTERS:
key = alias + " (deprecated)"
else:
key = alias
format_dict[key] = {} # Each dictionary represent 1 starter
format_dict[key]["template_path"] = spec.template_path
if spec.directory:
format_dict[alias]["directory"] = spec.directory
format_dict[key]["directory"] = spec.directory
return format_dict


Expand All @@ -178,6 +191,19 @@ def create_cli(): # pragma: no cover
@click.option("--directory", help=DIRECTORY_ARG_HELP)
def new(config_path, starter_alias, checkout, directory, **kwargs):
"""Create a new kedro project."""

if starter_alias in _DEPRECATED_STARTERS:
warnings.warn(
f"The starter '{starter_alias}' has been deprecated and will be archived from Kedro 0.19.0.",
KedroDeprecationWarning,
)
click.secho(
"From Kedro 0.19.0, the command `kedro new` will come with the option of interactively selecting add-ons "
"for your project such as linting, testing, custom logging, and more. The selected add-ons will add the "
"basic setup for the utilities selected to your projects.",
fg="green",
)

if checkout and not starter_alias:
raise KedroCliError("Cannot use the --checkout flag without a --starter value.")

Expand Down Expand Up @@ -257,6 +283,9 @@ def list_starters():
sorted_starters_dict = dict(
sorted(sorted_starters_dict.items(), key=lambda x: x == "kedro")
)
warnings.warn(
f"The starters {_DEPRECATED_STARTERS} are deprecated and will be archived in Kedro 0.19.0."
)

for origin, starters_spec in sorted_starters_dict.items():
click.secho(f"\nStarters from {origin}\n", fg="yellow")
Expand Down