Update main_app.py
Browse files- main_app.py +38 -18
main_app.py
CHANGED
|
@@ -498,7 +498,7 @@ def _(
|
|
| 498 |
package_meta,
|
| 499 |
ss_asset_response,
|
| 500 |
yaml_template,
|
| 501 |
-
base_software_spec_id_selector
|
| 502 |
):
|
| 503 |
packages_section = mo.md(
|
| 504 |
f"""
|
|
@@ -665,32 +665,29 @@ def _():
|
|
| 665 |
|
| 666 |
|
| 667 |
@app.cell
|
| 668 |
-
def _(template,base_software_spec_id_selector):
|
| 669 |
dependencies = template["dependencies"]
|
| 670 |
dependencies_string = ", ".join(dependencies)
|
| 671 |
|
| 672 |
if base_software_spec_id_selector.value == "runtime-25.1-py3.12":
|
| 673 |
# Format for Python 3.12 - simple list without pip:
|
| 674 |
-
added_yaml_template = f"""dependencies
|
| 675 |
-
{"\n".join(f" - {dep}" for dep in dependencies)}
|
| 676 |
"""
|
| 677 |
yaml_templates = {
|
| 678 |
-
"empty": """
|
| 679 |
-
- <library_name>
|
| 680 |
-
- ...
|
| 681 |
"""
|
| 682 |
}
|
| 683 |
else:
|
| 684 |
# Format for Python 3.11 - with pip:
|
| 685 |
added_yaml_template = f"""dependencies:
|
| 686 |
-
|
| 687 |
-
|
| 688 |
{"\n".join(f" - {dep}" for dep in dependencies)}
|
| 689 |
"""
|
| 690 |
yaml_templates = {
|
| 691 |
"empty": """dependencies:
|
| 692 |
-
|
| 693 |
-
|
| 694 |
- <library_name>
|
| 695 |
- ...
|
| 696 |
"""
|
|
@@ -728,11 +725,17 @@ def _(tempfile):
|
|
| 728 |
|
| 729 |
@app.cell
|
| 730 |
def _(mo, yaml_template, dependency_pack_name):
|
| 731 |
-
pkg_types = {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 732 |
|
| 733 |
package_meta = (
|
| 734 |
mo.md(
|
| 735 |
-
"""**Create your
|
|
|
|
|
|
|
| 736 |
|
| 737 |
{yml_editor}
|
| 738 |
|
|
@@ -776,7 +779,7 @@ def _(mo, yaml_template, dependency_pack_name):
|
|
| 776 |
max_length=int(256),
|
| 777 |
),
|
| 778 |
package_type=mo.ui.dropdown(
|
| 779 |
-
pkg_types, label="Select your package type:", value="
|
| 780 |
),
|
| 781 |
)
|
| 782 |
.form(show_clear_button=True, bordered=False)
|
|
@@ -785,7 +788,7 @@ def _(mo, yaml_template, dependency_pack_name):
|
|
| 785 |
|
| 786 |
|
| 787 |
@app.cell
|
| 788 |
-
def _(mo,dependencies_string):
|
| 789 |
check_packages = (
|
| 790 |
mo.md(
|
| 791 |
"""
|
|
@@ -863,7 +866,7 @@ def _(base_spec_id_names, mo):
|
|
| 863 |
|
| 864 |
|
| 865 |
@app.cell
|
| 866 |
-
def _(client,base_software_spec_id_selector,base_spec_ids):
|
| 867 |
if client is not None and base_software_spec_id_selector.value:
|
| 868 |
base_sw_spec_id = base_spec_ids[base_software_spec_id_selector.value]
|
| 869 |
base_software_spec = client.software_specifications.get_details(base_sw_spec_id)
|
|
@@ -873,6 +876,19 @@ def _(client,base_software_spec_id_selector,base_spec_ids):
|
|
| 873 |
return base_software_spec, base_sw_spec_id
|
| 874 |
|
| 875 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 876 |
@app.cell
|
| 877 |
def _(client, create_yaml_tempfile, package_meta, uuid):
|
| 878 |
if package_meta.value is not None and client is not None:
|
|
@@ -1309,9 +1325,11 @@ def _(mo):
|
|
| 1309 |
|
| 1310 |
|
| 1311 |
@app.cell
|
| 1312 |
-
def _(selection_table, set_selected_sw_spec):
|
| 1313 |
if selection_table.value is not None:
|
| 1314 |
set_selected_sw_spec(selection_table.value["ID"].iloc[0])
|
|
|
|
|
|
|
| 1315 |
return
|
| 1316 |
|
| 1317 |
|
|
@@ -1322,9 +1340,11 @@ def _(mo):
|
|
| 1322 |
|
| 1323 |
|
| 1324 |
@app.cell
|
| 1325 |
-
def _(hw_selection_table, set_selected_hw_spec):
|
| 1326 |
if hw_selection_table.value is not None:
|
| 1327 |
set_selected_hw_spec(hw_selection_table.value["ID"].iloc[0])
|
|
|
|
|
|
|
| 1328 |
return
|
| 1329 |
|
| 1330 |
|
|
|
|
| 498 |
package_meta,
|
| 499 |
ss_asset_response,
|
| 500 |
yaml_template,
|
| 501 |
+
base_software_spec_id_selector,
|
| 502 |
):
|
| 503 |
packages_section = mo.md(
|
| 504 |
f"""
|
|
|
|
| 665 |
|
| 666 |
|
| 667 |
@app.cell
|
| 668 |
+
def _(template, base_software_spec_id_selector):
|
| 669 |
dependencies = template["dependencies"]
|
| 670 |
dependencies_string = ", ".join(dependencies)
|
| 671 |
|
| 672 |
if base_software_spec_id_selector.value == "runtime-25.1-py3.12":
|
| 673 |
# Format for Python 3.12 - simple list without pip:
|
| 674 |
+
added_yaml_template = f"""{"\n".join(f"{dep}" for dep in dependencies)}
|
|
|
|
| 675 |
"""
|
| 676 |
yaml_templates = {
|
| 677 |
+
"empty": f"""<library_name>\n\n<library_name>
|
|
|
|
|
|
|
| 678 |
"""
|
| 679 |
}
|
| 680 |
else:
|
| 681 |
# Format for Python 3.11 - with pip:
|
| 682 |
added_yaml_template = f"""dependencies:
|
| 683 |
+
- pip
|
| 684 |
+
- pip:
|
| 685 |
{"\n".join(f" - {dep}" for dep in dependencies)}
|
| 686 |
"""
|
| 687 |
yaml_templates = {
|
| 688 |
"empty": """dependencies:
|
| 689 |
+
- pip
|
| 690 |
+
- pip:
|
| 691 |
- <library_name>
|
| 692 |
- ...
|
| 693 |
"""
|
|
|
|
| 725 |
|
| 726 |
@app.cell
|
| 727 |
def _(mo, yaml_template, dependency_pack_name):
|
| 728 |
+
pkg_types = {
|
| 729 |
+
"requirements.txt": "requirements_txt",
|
| 730 |
+
"Conda Yaml": "conda_yml",
|
| 731 |
+
"Custom user library": "custom_library",
|
| 732 |
+
}
|
| 733 |
|
| 734 |
package_meta = (
|
| 735 |
mo.md(
|
| 736 |
+
"""**Create your Package Extension by editing the template:**
|
| 737 |
+
|
| 738 |
+
{package_type}
|
| 739 |
|
| 740 |
{yml_editor}
|
| 741 |
|
|
|
|
| 779 |
max_length=int(256),
|
| 780 |
),
|
| 781 |
package_type=mo.ui.dropdown(
|
| 782 |
+
pkg_types, label="Select your package type:", value="requirements.txt"
|
| 783 |
),
|
| 784 |
)
|
| 785 |
.form(show_clear_button=True, bordered=False)
|
|
|
|
| 788 |
|
| 789 |
|
| 790 |
@app.cell
|
| 791 |
+
def _(mo, dependencies_string):
|
| 792 |
check_packages = (
|
| 793 |
mo.md(
|
| 794 |
"""
|
|
|
|
| 866 |
|
| 867 |
|
| 868 |
@app.cell
|
| 869 |
+
def _(client, base_software_spec_id_selector, base_spec_ids):
|
| 870 |
if client is not None and base_software_spec_id_selector.value:
|
| 871 |
base_sw_spec_id = base_spec_ids[base_software_spec_id_selector.value]
|
| 872 |
base_software_spec = client.software_specifications.get_details(base_sw_spec_id)
|
|
|
|
| 876 |
return base_software_spec, base_sw_spec_id
|
| 877 |
|
| 878 |
|
| 879 |
+
@app.cell
|
| 880 |
+
def _(
|
| 881 |
+
client,
|
| 882 |
+
):
|
| 883 |
+
if client:
|
| 884 |
+
base_hw_spec_id = "b128f957-581d-46d0-95b6-8af5cd5be580"
|
| 885 |
+
base_hardware_spec = client.hardware_specifications.get_details(base_hw_spec_id)
|
| 886 |
+
else:
|
| 887 |
+
base_hw_spec_id = None
|
| 888 |
+
base_hardware_spec = None
|
| 889 |
+
return base_hardware_spec, base_hw_spec_id
|
| 890 |
+
|
| 891 |
+
|
| 892 |
@app.cell
|
| 893 |
def _(client, create_yaml_tempfile, package_meta, uuid):
|
| 894 |
if package_meta.value is not None and client is not None:
|
|
|
|
| 1325 |
|
| 1326 |
|
| 1327 |
@app.cell
|
| 1328 |
+
def _(selection_table, set_selected_sw_spec, base_sw_spec_id):
|
| 1329 |
if selection_table.value is not None:
|
| 1330 |
set_selected_sw_spec(selection_table.value["ID"].iloc[0])
|
| 1331 |
+
else:
|
| 1332 |
+
set_selected_sw_spec(base_sw_spec_id)
|
| 1333 |
return
|
| 1334 |
|
| 1335 |
|
|
|
|
| 1340 |
|
| 1341 |
|
| 1342 |
@app.cell
|
| 1343 |
+
def _(hw_selection_table, set_selected_hw_spec, base_hw_spec_id):
|
| 1344 |
if hw_selection_table.value is not None:
|
| 1345 |
set_selected_hw_spec(hw_selection_table.value["ID"].iloc[0])
|
| 1346 |
+
else:
|
| 1347 |
+
set_selected_hw_spec(base_hw_spec_id)
|
| 1348 |
return
|
| 1349 |
|
| 1350 |
|