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

[Bug fix] - Make cookiecutter arguments consistent for all kedro new path #3266

Closed
wants to merge 9 commits into from

Conversation

noklam
Copy link
Contributor

@noklam noklam commented Nov 3, 2023

NOTE: Kedro datasets are moving from kedro.extras.datasets to a separate kedro-datasets package in
kedro-plugins repository. Any changes to the dataset implementations
should be done by opening a pull request in that repository.

Description

Development notes

  • Make sure the cookiecutter args is consistent, thus generating the same pyproject.toml in starters.
  • Added two tests test_cookiecutter_args, this catch a bug that we missed. For example kedro new --addons none return a '' for cookiecutter args, but [] for kedro new -> none (interactive prompt)
  • extra_context["add_ons"] should always return a list. (which is long string previously i.e. "Linting, PySpark")
  • In addition, upgrade pytest-mock because spy.return_value requires at least 1.10.0. Note, I think we should upgrade pytest-mock
    • The pin is very old (not urgent)
    • We shouldn't pin pytest-mock in templates at all. kedro project doesn't necessary follow kedro's test requirements. (create a new ticket)

Tests are failing because we need to propogate the same changes to kedro-starters, I have to use _cookiecutter instead of cookiecutter because of cookiecutter/cookiecutter#1975.

Notes:

  • starters are updated - you need to test this either with a local copy of kedro-starters or use the --checkout option (it's a temporary hack that still work because we haven't disable using both options and cookiecutter is fine with it, actually why do we want to block the --checkout option?)

Developer Certificate of Origin

We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a Signed-off-by line in the commit message. See our wiki for guidance.

If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.

Checklist

  • Read the contributing guidelines
  • Signed off each commit with a Developer Certificate of Origin (DCO)
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change in the RELEASE.md file
  • Added tests to cover my changes
  • Checked if this change will affect Kedro-Viz, and if so, communicated that with the Viz team

Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
@noklam noklam self-assigned this Nov 7, 2023
@noklam noklam changed the title Minor fix - cookiecutter args should be a list [Bug fix] - Make cookiecutter arguments consistent for all kedro new path Nov 10, 2023
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
@noklam noklam mentioned this pull request Nov 11, 2023
7 tasks
@noklam
Copy link
Contributor Author

noklam commented Nov 14, 2023

I don't think I can merge this PR in short term. @astrojuanlu any chance you may know someone from the cookiecutters team? We have the problem describe in cookiecutter/cookiecutter#1975.

It's not end of the world, the tradeoff is

  1. we need to do a bit more parsing with Jinja
  2. selected_add_ons_list is a str instead of list[str], basically it is a long string that looks like '['Pyspark', 'Linting']'

The tests that I have created in this PR should still be useful, but we don't have to rush it now.

@noklam
Copy link
Contributor Author

noklam commented Nov 23, 2023

I will close this PR since this is blocked by an upstream cookiecutter problem and our code has changed quite a bit already.

The main thing is it will be nice to refactor this using a proper list when choosing a tool/add-ons, but this doesn't affect the logic.

@noklam noklam closed this Nov 23, 2023
@astrojuanlu
Copy link
Member

I see cookiecutter still has activity, it's probably worth trying to contribute a fix upstream.

@merelcht merelcht deleted the noklam/fix-cookiecutter-addons branch January 18, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants