Skip to content

Commit

Permalink
fix remain issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab committed Dec 4, 2023
1 parent 52ee27c commit 51eb650
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/scicookie/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"flat"
],
"command_line_interface": [
"No command-line interface",
"None",
"Click",
"Argparse"
],
Expand Down
2 changes: 1 addition & 1 deletion src/scicookie/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
USE_BLUE = {{ cookiecutter.use_blue == "yes" }}
USE_BANDIT = {{ cookiecutter.use_bandit == "yes" }}
USE_CONTAINERS = {{ cookiecutter.use_containers in ['Docker', 'Podman'] }}
USE_CLI = {{ cookiecutter.command_line_interface != "No command-line interface" }}
USE_CLI = {{ cookiecutter.command_line_interface != "None" }}
USE_CONDA = {{ cookiecutter.use_conda == "yes" }}
USE_MAKE = {{ cookiecutter.use_make == "yes" }}
USE_MAKIM = {{ cookiecutter.use_makim == "yes" }}
Expand Down
29 changes: 19 additions & 10 deletions src/scicookie/profiles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ project_license:
message: Select one option for the project license
help: https://osl-incubator.github.io/scicookie/guide.html#information-about-the-project
type: single-choice
# first choice is the default
default: BSD 3 Clause
# first choice is the default for the UI
choices:
- BSD 3 Clause
- MIT
Expand All @@ -72,7 +73,8 @@ project_layout:
message: Select one option for the project layout
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#project-layout"
type: single-choice
# first choice is the default
default: src
# first choice is the default for the UI
choices:
- src
- flat
Expand All @@ -82,7 +84,8 @@ build_system:
message: Select one option for the build system
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#build-system"
type: single-choice
# first choice is the default
default: poetry
# first choice is the default for the UI
choices:
- poetry
- flit
Expand All @@ -99,9 +102,10 @@ command_line_interface:
message: Select one option for Command Line Interface (CLI)
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#command-line-interfaces-clis"
type: single-choice
# first choice is the default
default: None
# first choice is the default for the UI
choices:
- No command-line interface
- None
- Click
- Argparse
visible: false
Expand All @@ -110,7 +114,8 @@ documentation_engine:
message: Select one option for the Documentation Engine
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#documentation-engine"
type: single-choice
# first choice is the default
default: mkdocs
# first choice is the default for the UI
choices:
- mkdocs
- sphinx
Expand Down Expand Up @@ -153,7 +158,8 @@ use_containers:
message: Select one option for the container technology for this project
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#integration-with-devops-tools"
type: single-choice
# first choice is the default
default: None
# first choice is the default for the UI
choices:
- None
- Docker
Expand All @@ -169,7 +175,8 @@ code_of_conduct:
message: Select one option for the Code of Conduct
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#code-of-conduct"
type: single-choice
# first choice is the default
default: None
# first choice is the default for the UI
choices:
- None
- contributor-covenant
Expand All @@ -180,7 +187,8 @@ governance_document:
message: Select one option for a governance document template
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#governance-document"
type: single-choice
# first choice is the default
default: None
# first choice is the default for the UI
choices:
- None
- numpy-governance
Expand All @@ -191,7 +199,8 @@ roadmap_document:
message: Select one option for a Roadmap document template
help: "For more information, check:\n https://osl-incubator.github.io/scicookie/guide.html#roadmap-document"
type: single-choice
# first choice is the default
default: None
# first choice is the default for the UI
choices:
- None
- pytorch-ignite-roadmap
Expand Down
4 changes: 2 additions & 2 deletions src/scicookie/profiles/osl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ project_url:
visible: true

project_license:
# first choice is the default
# first choice is the default for the UI
choices:
- BSD 3 Clause
- MIT
Expand Down Expand Up @@ -88,7 +88,7 @@ git_username:
visible: true

git_https_origin:
default: "{{ 'https://github.com/' + git_username + '/' + project_slug }}"
default: ""
visible: true

git_https_upstream:
Expand Down
60 changes: 30 additions & 30 deletions src/scicookie/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,36 @@ def make_questions(questions: dict[str, Any]) -> dict[str, str]:

for question_id, question in questions.items():
question_obj = _create_question(question_id, question)

default_answer = question.get("default", "")
default_answer = Template(default_answer).render(answers)

# note: if question_object is None, that means that the question is
# not visible
if question_obj:
default_answer = question.get("default", "")
default_answer = Template(default_answer).render(answers)

if not check_dependencies_satisfied(question, answers):
answers[question_id] = default_answer
continue

message = question.get("message", "")
print(
Style.BRIGHT
+ f"{message} ("
+ Fore.YELLOW
+ f"default: {default_answer}"
+ Fore.RESET
+ Style.BRIGHT
+ "):"
+ Fore.RESET
)
print(Fore.BLUE + ">> HELP: " + question["help"] + Fore.RESET)
answer = inquirer.prompt([question_obj])

# note: if answer is none, it means that the user cancelled
# the process.
if answer is None:
return {}
answers[question_id] = (
answer.get(question_id, "") or default_answer
)
print("." * columns)
if not (
check_dependencies_satisfied(question, answers) and question_obj
):
answers[question_id] = default_answer
continue

message = question.get("message", "")
print(
Style.BRIGHT
+ f"{message} ("
+ Fore.YELLOW
+ f"default: {default_answer}"
+ Fore.RESET
+ Style.BRIGHT
+ "):"
+ Fore.RESET
)
print(Fore.BLUE + ">> HELP: " + question["help"] + Fore.RESET)
answer = inquirer.prompt([question_obj])

# note: if answer is none, it means that the user cancelled
# the process.
if answer is None:
return {}
answers[question_id] = answer.get(question_id, "") or default_answer
print("." * columns)
return answers

0 comments on commit 51eb650

Please sign in to comment.