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

Move _find_run_command from template to framework #4012

Merged
merged 18 commits into from
Aug 6, 2024
Merged

Conversation

merelcht
Copy link
Member

@merelcht merelcht commented Jul 16, 2024

Description

#3051
Moved the _find_run_command method from the project template to the framework itself.

This is necessary refactoring to make running packaged Kedro better (#3237)

Development notes

In the first attempt I moved the find run logic to kedro.framework.project.__init__, because that's also where configure_project() is. However, with that solution there are direct imports from kedro.framework.project to kedro.framework.cli which breaks the contract we've setup.

 from kedro.framework.cli.utils import (
        KedroCliError,
        load_entry_points,
    )
from kedro.framework.cli.project import run

Contract: https://github.com/kedro-org/kedro/blob/main/pyproject.toml#L159

In order not to break the import contract, I've moved the find run logic to kedro/framework/cli/project.py

Note

The same change to __main__.py needs to be done on the starters side

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: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
@merelcht merelcht changed the title Move _find_run_command from template to framework Move _find_run_command from template to framework Jul 16, 2024
merelcht and others added 3 commits July 17, 2024 14:27
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
@merelcht merelcht marked this pull request as ready for review July 23, 2024 08:31
@merelcht merelcht self-assigned this Jul 23, 2024
Copy link
Contributor

@ElenaKhaustova ElenaKhaustova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ✨

Shall we create a ticket on starters side?

Copy link
Contributor

@noklam noklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good in general. I wonder if you found the reason why this was necessary to be implemented in the starter side instead of kedro at first place?

kedro/framework/cli/project.py Outdated Show resolved Hide resolved
@merelcht
Copy link
Member Author

It looks good in general. I wonder if you found the reason why this was necessary to be implemented in the starter side instead of kedro at first place?

It was implemented as part of making cli.py in the templates optional and the simple reason is that at the time this seemed the most logical place. When we later decided it should be moved, we never ended up prioritising because users didn't complain.

@merelcht
Copy link
Member Author

Shall we create a ticket on starters side?

Done: kedro-org/kedro-starters#228

Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
merelcht and others added 6 commits August 1, 2024 17:06
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
kedro/framework/cli/utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@noklam noklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Approved with a small comment.

merelcht and others added 2 commits August 5, 2024 17:14
Co-authored-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>
Signed-off-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Copy link
Contributor

@ElenaKhaustova ElenaKhaustova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@merelcht merelcht merged commit a153afd into main Aug 6, 2024
41 checks passed
@merelcht merelcht deleted the prototype-entrypoint branch August 6, 2024 08:04
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.

Simplify Packaged Kedro Project entrypoint __main__.py, move _find_run_command to Framework
4 participants