-
Notifications
You must be signed in to change notification settings - Fork 923
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 project commands work from any directory inside a project #1831
Comments
Originally posted by @noklam in #2541 (comment) @noklam is that solution in some unmerged pull request? Maybe #1720 ? |
@astrojuanlu there are two part of it.
The PR you mentioned is the draft, after technical design we decide to split it in two the two tickets. |
Maybe we can frame this as making kedro more usable in standalone or non standard kedro project in some way. |
I think this is going to be a usability improvement for everybody, even for normal Kedro users. It happens very often, even to myself. @antonymilne already left some ideas on how this could be done. |
Yes, I started this initially in #1720 We already have the PoC for implementation so it shouldn't be too difficult to implement. |
At the very least giving a helpful error message that the command the user typed is known, but they need to be in the right directory to do it |
I think the only concern for this is how far should it try to look for the |
At the moment, kedro/kedro/ipython/__init__.py Lines 165 to 171 in 4a7b132
we could use |
I think I just found a good example that we need to unit test, potentially issue even with current
|
Technically this fall out of scope because it's not inside kedro project, but I think it is a good example that we need to test it throughly and think outside of a "standard kedro project" structure. |
Also maybe we should make them work anywhere? For example, I wanted to do |
Getting out of detecting a Kedro project makes this task even easier, I'd say (and then, the moment you want to actually run the command, if there's no |
In my which at the very least gave you a helpful message if you were out of a project directory. |
I'd add that testing this with a more complicated repository structure, where it contains a normal python project and a kedro project. The key is to make sure it functions properly when there are multiple pyproject.toml or at least fail gracefully. |
When a kedro project command (e.g.
kedro run
) is run from inside a project but not the project root it doesn't work. There doesn't seem to be any good reason for this. Other tools (.e.g black, git) work from project subfolders, so let's do the same with kedro._find_kedro_project
in the ipython extension. This would likely be made more performant if it used iterated throughcurrent_dir.parents
rather than the while loop that's currently there. Do a quick bit of profiling to see what the best way to do this isutils
so the ipython extension and CLI can both use itkedro
to show all the project commands from inside a subdirectory you'll need to changeKedroCLI(project_path=Path.cwd())
toKedroCLI(project_path=_find_kedro_project(Path.cwd()))
KedroSession
will need to use the correct project root. This could be done by providing the rightproject_path
wheneverKedroSession
is instantiated or (probably better) altering theKedroSession
itself fromself._project_path = Path(project_path or Path.cwd()).resolve()
toself._project_path = Path(project_path or _find_kedro_project(Path.cwd()).resolve())
The text was updated successfully, but these errors were encountered: