Skip to content

Commit

Permalink
Merge pull request #2415 from Avaiga/feature/enterprise#610-update-te…
Browse files Browse the repository at this point in the history
…mplate-questions

Feature - Update template questions
  • Loading branch information
trgiangdo authored Jan 20, 2025
2 parents a94a814 + 0c7bd74 commit 4821be5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
20 changes: 10 additions & 10 deletions taipy/templates/default/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"Application root folder name": "taipy_application",
"Application root folder": "taipy_application",
"Application main Python file": "main.py",
"Application title": "Taipy Application",
"Page names in multi-page application?": "",
"Does the application use scenario management or version management?": "No",
"Does the application use Rest API?": "No",
"Do you want to initialize a new Git repository?": "No",
"With multi-pages?\n\tEnter the page names separated by a space": "",
"With scenario management?": "No",
"With a Rest API?": "No",
"With a new Git repository?": "No",

"__root_folder": "{{ cookiecutter['Application root folder name'] | replace(' ','-') }}",
"__root_folder": "{{ cookiecutter['Application root folder'] | replace(' ','-') }}",
"__main_file": "{{ cookiecutter['Application main Python file'][:-3] if cookiecutter['Application main Python file'].endswith('.py') else cookiecutter['Application main Python file'] }}",
"__application_title": "{{ cookiecutter['Application title'] }}",
"__pages": "{{ cookiecutter['Page names in multi-page application?'] }}",
"__orchestrator": "{{ cookiecutter['Does the application use scenario management or version management?'] }}",
"__rest": "{{ cookiecutter['Does the application use Rest API?'] }}",
"__git": "{{ cookiecutter['Do you want to initialize a new Git repository?']}}"
"__pages": "{{ cookiecutter['With multi-pages?\n\tEnter the page names separated by a space'] }}",
"__orchestrator": "{{ cookiecutter['With scenario management?'] }}",
"__rest": "{{ cookiecutter['With a Rest API?'] }}",
"__git": "{{ cookiecutter['With a new Git repository?']}}"
}
12 changes: 6 additions & 6 deletions taipy/templates/sdm/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"Application root folder name": "taipy_application",
"Application root folder": "taipy_application",
"Application main Python file": "main.py",
"Application title": "Taipy Application",
"Does the application use TOML Config?": "No",
"Do you want to initialize a new Git repository?": "No",
"With TOML Config?": "No",
"With a new Git repository?": "No",

"__root_folder": "{{ cookiecutter['Application root folder name'] | replace(' ','-') }}",
"__root_folder": "{{ cookiecutter['Application root folder'] | replace(' ','-') }}",
"__main_file": "{{ cookiecutter['Application main Python file'][:-3] if cookiecutter['Application main Python file'].endswith('.py') else cookiecutter['Application main Python file'] }}",
"__application_title": "{{ cookiecutter['Application title'] }}",
"__use_toml_config": "{{ cookiecutter['Does the application use TOML Config?'] }}",
"__git": "{{ cookiecutter['Do you want to initialize a new Git repository?']}}"
"__use_toml_config": "{{ cookiecutter['With TOML Config?'] }}",
"__git": "{{ cookiecutter['With a new Git repository?']}}"
}
26 changes: 13 additions & 13 deletions tests/templates/test_default_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_main_file_with_and_without_extension(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Application root folder": "foo_app",
"Application main Python file": "app",
},
)
Expand All @@ -64,8 +64,8 @@ def test_with_orchestrator_service(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Does the application use scenario management or version management?": "y",
"Does the application use Rest API?": "no",
"With scenario management?": "y",
"With a Rest API?": "no",
},
)

Expand All @@ -89,8 +89,8 @@ def test_with_rest_service(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Does the application use scenario management or version management?": "n",
"Does the application use Rest API?": "yes",
"With scenario management?": "n",
"With a Rest API?": "yes",
},
)

Expand All @@ -112,8 +112,8 @@ def test_with_both_orchestrator_rest_services(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Does the application use scenario management or version management?": "y",
"Does the application use Rest API?": "yes",
"With scenario management?": "y",
"With a Rest API?": "yes",
},
)

Expand All @@ -138,8 +138,8 @@ def test_multipage_gui_template(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Page names in multi-page application?": "name_1 name_2 name_3",
"Application root folder": "foo_app",
"With multi-pages?\n\tEnter the page names separated by a space": "name_1 name_2 name_3",
},
)

Expand All @@ -160,8 +160,8 @@ def test_multipage_gui_template_with_invalid_page_name(tmpdir, capfd):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Page names in multi-page application?": "valid_var_name 1_invalid_var_name",
"Application root folder": "foo_app",
"With multi-pages?\n\tEnter the page names separated by a space": "valid_var_name 1_invalid_var_name",
},
)

Expand All @@ -177,8 +177,8 @@ def test_with_git(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Do you want to initialize a new Git repository?": "y",
"Application root folder": "foo_app",
"With a new Git repository?": "y",
},
)

Expand Down
12 changes: 6 additions & 6 deletions tests/templates/test_scenario_mgt_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def test_scenario_management_with_toml_config(tmpdir):
output_dir=tmpdir,
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Application root folder": "foo_app",
"Application main Python file": "main.py",
"Application title": "bar",
"Does the application use TOML Config?": "yes",
"With TOML Config?": "yes",
},
)

Expand Down Expand Up @@ -54,10 +54,10 @@ def test_scenario_management_without_toml_config(tmpdir):
output_dir=tmpdir,
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Application root folder": "foo_app",
"Application main Python file": "main.py",
"Application title": "bar",
"Does the application use TOML Config?": "no",
"With TOML Config?": "no",
},
)

Expand Down Expand Up @@ -85,8 +85,8 @@ def test_with_git(tmpdir):
output_dir=str(tmpdir),
no_input=True,
extra_context={
"Application root folder name": "foo_app",
"Do you want to initialize a new Git repository?": "y",
"Application root folder": "foo_app",
"With a new Git repository?": "y",
},
)

Expand Down

0 comments on commit 4821be5

Please sign in to comment.