-
Notifications
You must be signed in to change notification settings - Fork 910
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
Add add_ons
metadata to pyproject.toml
for project creation
#3188
Conversation
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
It's functional already, the question is whether we want to keep the options [1,2,3] or the name i.e. ["Linting","Documentation"]. I also have some question around the project creation flow since this is my first ticket related to this theme. |
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
kedro/framework/cli/starters.py
Outdated
ADD_ONS_DICT = { | ||
"1": "Linting", | ||
"2": "Testing", | ||
"3": "Custom Logging", | ||
"4": "Documentation", | ||
"5": "Data structure", | ||
} |
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 need to be used multiple place, probably tests as well.
@@ -161,6 +166,50 @@ def _starter_spec_to_dict( | |||
return format_dict | |||
|
|||
|
|||
def _parse_add_ons_input(add_ons_str: str): |
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.
move from the hooks - parsing logic should be in cli.py
instead of post_hook
docs_path = current_dir / "docs" | ||
if docs_path.exists(): | ||
shutil.rmtree(str(docs_path)) | ||
else: | ||
with open(pyproject_file_path, 'a') as file: | ||
file.write(docs_pyproject_requirements) | ||
|
||
if "5" not in selected_add_ons_list: # If Data Structure not selected | ||
if "Data Structure" not in selected_add_ons_list: |
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 this name finalised already? I find this a bit awkward and doesn't match the terminology in our docs? cc @amandakys
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.
On #3216 she commented it should be "Data Folder"
kedro/framework/cli/starters.py
Outdated
add_ons = config.get("add_ons") | ||
if add_ons: | ||
config["add_ons"] = [ | ||
ADD_ONS_DICT[add_on] for add_on in _parse_add_ons_input(add_ons) | ||
] | ||
config["add_ons"] = str(config["add_ons"]) |
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.
Update the cookiecutter.add_ons
to the actual name instead of nunber.
I will mark as ready for review when the tests are fixed. |
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Merge branch 'noklam/ci-add-on' of https://github.com/kedro-org/kedro into noklam/ci-add-on Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
kedro/framework/cli/starters.py
Outdated
"2": "Testing", | ||
"3": "Custom Logging", | ||
"4": "Documentation", | ||
"5": "Data structure", |
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.
Data structure -> Data Structure
Signed-off-by: Nok <nok.lam.chan@quantumblack.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.
Awesome work @noklam, overall, the refactoring looks great and cleaner. I've tested it manualy and its working as expected. 🌟🌟
@@ -353,11 +402,20 @@ def _make_cookiecutter_args( | |||
""" | |||
config.setdefault("kedro_version", version) | |||
|
|||
# Map the selected add on lists to readable name | |||
add_ons:str = config.get("add_ons") | |||
if add_ons: |
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.
Will add_ons ever be null
?
Removed @merelcht from reviewer list since she is sick. Would be still great to review if this isn't merged yet but I have asked @ankatiyar for review because this PR will block a few other PR so it best to get merged soon. |
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.
Tested this manually. Also good work on refactoring :D
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.
RELEASE.md
Outdated
@@ -5,6 +5,7 @@ | |||
* Introduced add-ons to the `kedro new` CLI flow. | |||
|
|||
## Bug fixes and other changes | |||
- Added a new field `add-ons` to `pyproject.toml` when a project is created. |
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.
Nit 🙈
- Added a new field `add-ons` to `pyproject.toml` when a project is created. | |
* Added a new field `add-ons` to `pyproject.toml` when a project is created. |
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 keep forgetting this since -
is easier to type ...
docs_path = current_dir / "docs" | ||
if docs_path.exists(): | ||
shutil.rmtree(str(docs_path)) | ||
else: | ||
with open(pyproject_file_path, 'a') as file: | ||
file.write(docs_pyproject_requirements) | ||
|
||
if "5" not in selected_add_ons_list: # If Data Structure not selected | ||
if "Data Structure" not in selected_add_ons_list: |
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.
On #3216 she commented it should be "Data Folder"
Signed-off-by: Nok <nok.lam.chan@quantumblack.com>
Signed-off-by: Sajid Alam <90610031+SajidAlamQB@users.noreply.github.com>
Signed-off-by: Nok Lam Chan <nok.lam.chan@quantumblack.com>
Description
Development notes
I added more comments in the changed files. It's a bit tricky to get everything works
Overall there are few changes and refactoring. There are few benefit of using names over number:
starter
, cookiecutter will store the parsed list i.e ["Linting","Documentation"]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