kedro icon indicating copy to clipboard operation
kedro copied to clipboard

Improve the error message & docstring of `kedro new` for custom starters

Open noklam opened this issue 1 year ago • 4 comments

Part of #2604

Context

The error message of kedro new is not very accurate. This was found when we try to use kedro new for a new starter that haven't been added to the official starters list.

There are at least 2 common ways (Added more if found)

  1. kedro new -s pandas-iris , using kedro new for official starters

  2. kedro new --starter <some_directory> --checkout <branch> --directory <directory>, use it for custom starters in local or repository (not documented)

  3. should be documented as it is not easy to figure out with the docstring and CLI help message. In addition, the error message isn't accurate

    if starter_alias in starters_dict:
        if directory:
            raise KedroCliError(
                "Cannot use the --directory flag with a --starter alias."
            )

This is very confusing because to do 2. you need to use both starter and directory, but the error message says the opposite.

i.e. kedro new --starter git+https://github.com/kedro-org/kedro-starters.git --directory databricks-iris --checkout feat/modify-pyspark-iris-databricks-packaged-deployment (This works)

The help message have some information about --starter flag can be provided as a git URL

The help message actually provide more accurate information.

 -s, --starter TEXT  Specify the starter template to use when creating the
                      project. This can be the path to a local directory, a
                      URL to a remote VCS repository supported by
                      `cookiecutter` or one of the aliases listed in ``kedro
                      starter list``.

Action

  • Improve the docstring or error message or both, add example to make it easier to discover the feature.

noklam avatar May 30 '23 13:05 noklam

Hey @astrojuanlu, @merelcht, I would like to take this up!

MinuraPunchihewa avatar Oct 06 '23 10:10 MinuraPunchihewa

Hi @MinuraPunchihewa , thanks for stepping in! @AhdraMeraliQB does this somehow conflict with the new add-ons flow?

astrojuanlu avatar Oct 06 '23 11:10 astrojuanlu

CC: @noklam

This is very confusing because to do 2. you need to use both starter and directory, but the error message says the opposite.

The error message results if an official Kedro starter-alias is used with --directory, hence why using a git url works. Perhaps the issue here is that the error message "Cannot use the --directory flag with a --starter alias." is not clear enough?

Option: "Cannot use the --directory flag with a Kedro starter alias."

I agree that this should be visibly documented, an addition should be made to https://docs.kedro.org/en/stable/starters/starters.html, but I'm unsure the error message itself needs to be modified

AhdraMeraliQB avatar Jan 11 '24 11:01 AhdraMeraliQB

PR is ready: https://github.com/kedro-org/kedro/pull/3771 I only updated docs and add more examples. I agree with @AhdraMeraliQB that error message itself dosen't needs to be modified

doxenix avatar Apr 02 '24 14:04 doxenix

This was addressed in #3771!

astrojuanlu avatar May 27 '24 07:05 astrojuanlu