outerbounds 0.3.174__py3-none-any.whl → 0.3.175rc0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ from . import experimental
2
+
3
+
4
+ def build_config_from_options(options):
5
+ """Build an app configuration from CLI options."""
6
+ config = {}
7
+
8
+ # Set basic fields
9
+ for key in ["name", "port", "image", "compute_pools"]:
10
+ if options.get(key):
11
+ config[key] = options[key]
12
+
13
+ # Handle list fields
14
+ if options.get("tags"):
15
+ config["tags"] = list(options["tags"])
16
+ if options.get("secrets"):
17
+ config["secrets"] = list(options["secrets"])
18
+
19
+ # Build env dict from key-value pairs
20
+ if options.get("envs"):
21
+ env_dict = {}
22
+ for env_item in options["envs"]:
23
+ env_dict.update(env_item)
24
+ config["environment"] = env_dict
25
+
26
+ # Handle dependencies (only one type allowed)
27
+ deps = {}
28
+ if options.get("dep_from_task"):
29
+ deps["from_task"] = options["dep_from_task"]
30
+ elif options.get("dep_from_run"):
31
+ deps["from_run"] = options["dep_from_run"]
32
+ elif options.get("dep_from_requirements"):
33
+ deps["from_requirements_file"] = options["dep_from_requirements"]
34
+ elif options.get("dep_from_pyproject"):
35
+ deps["from_pyproject_toml"] = options["dep_from_pyproject"]
36
+
37
+ # TODO: [FIX ME]: Get better CLI abstraction for pypi/conda dependencies
38
+
39
+ if deps:
40
+ config["dependencies"] = deps
41
+
42
+ # Handle resources
43
+ resources = {}
44
+ for key in ["cpu", "memory", "gpu", "storage"]:
45
+ if options.get(key):
46
+ resources[key] = options[key]
47
+
48
+ if resources:
49
+ config["resources"] = resources
50
+
51
+ # Handle health check options
52
+ health_check = {}
53
+ if options.get("health_check_enabled") is not None:
54
+ health_check["enabled"] = options["health_check_enabled"]
55
+ if options.get("health_check_path"):
56
+ health_check["path"] = options["health_check_path"]
57
+ if options.get("health_check_initial_delay") is not None:
58
+ health_check["initial_delay_seconds"] = options["health_check_initial_delay"]
59
+ if options.get("health_check_period") is not None:
60
+ health_check["period_seconds"] = options["health_check_period"]
61
+
62
+ if health_check:
63
+ config["health_check"] = health_check
64
+
65
+ # Handle package options
66
+ if options.get("package_src_path") or options.get("package_suffixes"):
67
+ config["package"] = {}
68
+ if options.get("package_src_path"):
69
+ config["package"]["src_path"] = options["package_src_path"]
70
+ if options.get("package_suffixes"):
71
+ config["package"]["suffixes"] = options["package_suffixes"]
72
+
73
+ # Handle auth options
74
+ if options.get("auth_type") or options.get("auth_public"):
75
+ config["auth"] = {}
76
+ if options.get("auth_type"):
77
+ config["auth"]["type"] = options["auth_type"]
78
+ if options.get("auth_public"):
79
+ config["auth"]["public"] = options["auth_public"]
80
+
81
+ replicas = {}
82
+ if options.get("min_replicas"):
83
+ replicas["min"] = options["min_replicas"]
84
+ if options.get("max_replicas"):
85
+ replicas["max"] = options["max_replicas"]
86
+ if len(replicas) > 0:
87
+ config["replicas"] = replicas
88
+
89
+ config.update(experimental.build_config_from_options(options))
90
+
91
+ return config
@@ -0,0 +1,3 @@
1
+ from .code_packager import CodePackager
2
+
3
+ __all__ = ["CodePackager"]