-
Notifications
You must be signed in to change notification settings - Fork 922
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
Make kedro commands work from inside subdirectories in project #3683
Conversation
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Super good push! Possibly a different ticket - but it would be nice to catch some of the common
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a manual test with arbitary deep directory with kedro run
,kedro ipython
, all works well. This is such a small change but big improvement in the developer experience.
It checks all the parents, which I think it's good. Alternatively we are try to traverse the directory up, we run into risks that we execute other kedro project accidentally.
Out of scope:
@rashidakanchwala I test viz command and it's failing.
Since this breaks |
Hi Nok, Currently the commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks all good and I've tested it successfully as well 👍 I agree with @noklam that even though it can be considered breaking, it should be shipped in the 0.19.x series.
On the viz issue we could either change the logic there, or at the least make the error message clearer when running Viz in a subdirectory.
kedro/framework/session/session.py
Outdated
@@ -104,7 +105,9 @@ def __init__( # noqa: PLR0913 | |||
save_on_close: bool = False, | |||
conf_source: str | None = None, | |||
): | |||
self._project_path = Path(project_path or Path.cwd()).resolve() | |||
self._project_path = Path( | |||
project_path or _find_kedro_project(Path.cwd()).resolve() or Path.cwd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we called .resolve()
on all options project_path
as well as Path.cwd()
and now only on _find_kedro_project(Path.cwd()).resolve()
, why did that change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
@@ -1,6 +1,7 @@ | |||
# Upcoming Release 0.19.4 | |||
|
|||
## Major features and improvements | |||
* Kedro commands now work from any subdirectory within a Kedro project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_is_project
and _find_kedro_project
are private methods, but it might be worth mentioning in the release notes section "Breaking changes to the API" that these were moved to kedro.utils
, just in case people are using them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
Signed-off-by: Ankita Katiyar <ankitakatiyar2401@gmail.com>
Signed-off-by: Ankita Katiyar <110245118+ankatiyar@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change! It makes working with Kedro in terminal so much smoother.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 😄
Wow, this was so fast I didn't even have time to review it. Well done everyone ❤️ |
Description
Fix #1831
Development notes
_find_kedro_project()
and_is_project()
tokedro.utils
so it can be used both byKedroCLI
andkedro.ipython
extension_find_kedro_project()
to usePath.parents
project_path
forKedroCLI
andKedroSession
to use_find_kedro_project()
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
RELEASE.md
file