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

Kedro new starter CLI : user_input.lower() #3783

Open
Ipsedo opened this issue Apr 5, 2024 · 7 comments
Open

Kedro new starter CLI : user_input.lower() #3783

Ipsedo opened this issue Apr 5, 2024 · 7 comments
Labels
Community Issue/PR opened by the open-source community good first issue Good first issues for beginners Hacktoberfest Issue suitable for hacktoberfest Issue: Bug Report 🐞 Bug that needs to be fixed

Comments

@Ipsedo
Copy link

Ipsedo commented Apr 5, 2024

Description

I use kedro starter CLI configured by prompt.yml with regex check and I think I found one issue : the user inputs are systematically transformed to lowercase : https://github.com/kedro-org/kedro/blob/main/kedro/framework/cli/starters.py#L957
The result is that I can't restrict user input to uppercase or lowercase

Context

I want to restrict user input to uppercase

Steps to Reproduce

  1. create a cookiecutter template for kedro (regarding your need)
  2. create your cookiecutter.json with project_name as unique prompt
  3. create your prompt.yml with an entry for project_name
  4. set the regex_validator field to "[A-Z_]+"
  5. start kedro new --starter=./my_starter and answer MY_PROJECT for project_name prompt
  6. It will fail due to the user_input.lower() in kedro/framework/cli/starters.py line 957

Expected Result

The regex and the input must match

Actual Result

The user input is refused

Your Environment

Python : 3.9.13
Kedro : 0.19.3
OS : Linux (distribution and kernel version confidential)

@noklam
Copy link
Contributor

noklam commented Apr 5, 2024

I think that is by design that we don't allow upper case. As I understand this is the convention for Python community.

https://gist.github.com/etigui/7600441926e73c3385057718c2fdef8e

However the error may not be clear enough, curious if you are creating your own starters?

@Ipsedo
Copy link
Author

Ipsedo commented Apr 5, 2024

I know about python naming convention, the point is not here : the regex of prompt for project name in uppercase was just for the example.
In reality I use the regex for a variable value in the project which needs to be in uppercase, your code is clear : you apply lower() method on the user input which is not correct.

@noklam
Copy link
Contributor

noklam commented Apr 5, 2024

@lpsedo got it, would you like to send a PR to fix this? It should be a relative simple one happy to merge this.

@noklam noklam added the Issue: Bug Report 🐞 Bug that needs to be fixed label Apr 8, 2024
@Ipsedo
Copy link
Author

Ipsedo commented Apr 10, 2024

Sure, I will potentially make the PR this weekend

@merelcht
Copy link
Member

Hi @Ipsedo are you still interested in creating a PR for this?

@merelcht merelcht added the Community Issue/PR opened by the open-source community label May 20, 2024
@merelcht merelcht added the good first issue Good first issues for beginners label Jul 8, 2024
@parthmshah1302
Copy link

@merelcht I would like to work on this - do I need to be assigned first or should I submit a PR directly?

@merelcht
Copy link
Member

Hi @parthmshah1302, thanks for helping out! You can just go ahead and create a PR when you're ready 🙂

@merelcht merelcht added the Hacktoberfest Issue suitable for hacktoberfest label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Issue/PR opened by the open-source community good first issue Good first issues for beginners Hacktoberfest Issue suitable for hacktoberfest Issue: Bug Report 🐞 Bug that needs to be fixed
Projects
Status: To Do
Development

No branches or pull requests

4 participants