-
Notifications
You must be signed in to change notification settings - Fork 903
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
Change to short names in config #3499
Conversation
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.
Manually tested, works well! Thanks @DimedS!
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.
Could you update the tools docs pages too within this PR?
- https://docs.kedro.org/en/stable/starters/new_project_tools.html#specify-tools-configuration-using-kedro-new-config
- https://docs.kedro.org/en/stable/starters/index.html#:~:text=from%20comma%2Dseparated-,values%2C%20ranges%2C,-or%20%E2%80%98all/none
Additionally don't forget to put these changes in RELEASE.md
with a note about them breaking tools config
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 code is starting to look a lot better with these refactorings, but I think there's still a bit more we can do. I've left comments with some suggestions.
Signed-off-by: Dmitry Sorokin <dmd40in@gmail.com>
d8d66e7
to
829d048
Compare
Signed-off-by: Dmitry Sorokin <dmd40in@gmail.com>
Signed-off-by: Dmitry Sorokin <dmd40in@gmail.com>
thank you for the links @AhdraMeraliQB , fixed |
Thank you, @merelcht , for your valuable suggestions. I've implemented them and they indeed make a lot of sense. Could you help me understand the purpose of the test_fetch_config_from_user_prompts_with_context() function? I've temporarily removed it as I'm unsure how to modify it after updating the fetch_config_from_user_prompts() function. Your guidance on this would be greatly appreciated. |
I added that test to cover these lines: kedro/kedro/framework/cli/starters.py Lines 694 to 695 in 34e66c3
Test coverage seems to be fine though, so I guess it might be tested in another way now and |
) | ||
# set defaults for required fields, will be used mostly for starters | ||
extra_context.setdefault("kedro_version", version) | ||
extra_context.setdefault("tools", str(["None"])) |
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.
str(["None"])
still seems like a bit of an odd value to me.. We don't have to change that in this PR, but I think it would be good to discuss.
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 agree with that
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.
Idea, just noting this here but not adding to the scope of the PR - could we save it as an unwrapped list ["None"]
instead?
Context:
The reason we pass through a list wrapped in a string is because cookiecutter
interprets a list as a provision of options, from which it selects one to save. To preserve all the chosen tools, we wrap the list in a string. Though the option for no tools is processed separately, pyproject.toml
has no knowledge of what is passed through and so we cannot pass through just the string "None" (which will be unwrapped).
However, none tools cannot be selected with any other tools, and so passing through just a list shouldn't have any adverse effects; cookiecutter
would pick the only option from the list - "None" - and pass that through to pyproject.toml
.
Would we run into the same problem with unwrapping strings? If so we could always pass through [["None"]]
but it doesn't seem much better than str(["None"])
🤔
Additionally, for telemetry, should we be consistent with what we store (a list for several tools, but this would save a string if no tools are selected)?
Alternatively, I believe using dictionaries to pass a collection of objects through cookiecutter
is possible, but it would require significant changes to pyproject.toml - I'm unsure we'd be able to preserve the list type as we'd have to somehow process these values within the cookiecutter
execution.
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.
@AhdraMeraliQB , and why we need a string of a list? Why just a string is not enough, like:
tools = "Linting, Testing, ..." or tools = "None"
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.
@DimedS
If I remember correctly, the reason is tied to telemetry - it's easier (and more intuitive) to query tools data when stored as a list than as a string. We did originally pass this through as a string (xref), but was suggested to be changed as part of #3264 and in #3333
The fix in #3426 introduced using str["None"] to workaround cookiecutter
limitations (see Nok's comment) and the rest is history 😅
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.
Leaving my comments on the implementation here, they affect some of the choices made in test_starters.py
so I'll wait to resolve these before continuing the review of that file
Signed-off-by: Dmitry Sorokin <40151847+DimedS@users.noreply.github.com>
Signed-off-by: Dmitry Sorokin <dmd40in@gmail.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.
This looks amazing!! Thank you for all the changes - only one significant question (re: the error messages) from me 😄
Co-authored-by: Ahdra Merali <90615669+AhdraMeraliQB@users.noreply.github.com> Signed-off-by: Dmitry Sorokin <40151847+DimedS@users.noreply.github.com>
Signed-off-by: Dmitry Sorokin <40151847+DimedS@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.
Fantastic work @DimedS!! Thanks for making all the changes, this will make the file so much easier to read 🌟
The PR has changed quite a bit since the first approval, I've re-requested @ankatiyar to take a new look at this before we give it the final send-off 🚀
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.
Thanks @DimedS for the fix as well as a refactoring! 👍🏾
Thank you for your contribution @AhdraMeraliQB , @ankatiyar , @merelcht ! |
Description
This PR addresses Issue 4 from #3335, implementing the following changes:
test_tools_flag_none()
withtest_valid_tools_flag()
as the only difference between them is a single line._convert_tool_names_to_numbers()
function to return a list directly instead of string, eliminating the need for additional processing. The_parse_tools_input()
function was utilized for this purpose._get_extra_context()
function for enhanced clarity. It's divided into distinct sections, with a specific section for default values._validate_range(start, end)
function, which checks the range interval of tools. Previously, entering an excessively large end value would cause the prompt to freeze. An additional check for the upper limit of the range has been introduced to prevent this issue.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