truefoundry 0.3.0rc14__py3-none-any.whl → 0.3.1__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.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

@@ -1,12 +1,14 @@
1
1
  import functools
2
2
  import sys
3
3
  import zipfile
4
+ from typing import Dict
4
5
 
5
6
  import rich_click as click
6
7
  from packaging.version import parse as parse_version
7
8
  from requests.exceptions import ConnectionError
8
9
  from rich.padding import Padding
9
10
  from rich.panel import Panel
11
+ from rich.table import Table
10
12
 
11
13
  from truefoundry.deploy.cli.console import console
12
14
  from truefoundry.deploy.lib.exceptions import (
@@ -27,16 +29,29 @@ def handle_exception(exception):
27
29
  if is_debug_env_set():
28
30
  console.print_exception(show_locals=True)
29
31
  if isinstance(exception, BadRequestException):
30
- print_error(
31
- f"[cyan bold]status_code[/] {exception.status_code}\n"
32
- f"[cyan bold]message[/] {exception.message}"
32
+ print_dict_as_table_panel(
33
+ {"Status Code": str(exception.status_code), "Error": exception.message},
34
+ title="Command Failed",
35
+ border_style="red",
33
36
  )
34
37
  elif isinstance(exception, ConnectionError):
35
- print_error("Couldn't connect to TrueFoundry.")
38
+ print_dict_as_table_panel(
39
+ {"Error": "Couldn't connect to TrueFoundry"},
40
+ title="Command Failed",
41
+ border_style="red",
42
+ )
36
43
  elif isinstance(exception, ConfigurationException):
37
- print_error(f"[cyan bold]message[/] {exception.message}")
44
+ print_dict_as_table_panel(
45
+ {"Error": exception.message},
46
+ title="Command Failed",
47
+ border_style="red",
48
+ )
38
49
  else:
39
- console.print(f"[red][bold]Error:[/] {str(exception)}[/]")
50
+ print_dict_as_table_panel(
51
+ {"Error": str(exception)},
52
+ title="Command Failed",
53
+ border_style="red",
54
+ )
40
55
 
41
56
 
42
57
  def handle_exception_wrapper(fn):
@@ -77,6 +92,28 @@ def print_message(message):
77
92
  )
78
93
 
79
94
 
95
+ def print_dict_as_table_panel(
96
+ dct: Dict[str, str],
97
+ title: str,
98
+ border_style: str = "cyan",
99
+ key_color: str = "cyan",
100
+ ):
101
+ table = Table(show_header=False, box=None)
102
+ table.add_column("Key", style=f"bold {key_color}", width=15)
103
+ table.add_column("Value")
104
+ for key, value in dct.items():
105
+ table.add_row(key, value)
106
+ console.print(
107
+ Panel(
108
+ table,
109
+ border_style=border_style,
110
+ title=title,
111
+ title_align="left",
112
+ width=click.rich_click.MAX_WIDTH,
113
+ )
114
+ )
115
+
116
+
80
117
  def unzip_package(path_to_package, destination):
81
118
  with zipfile.ZipFile(path_to_package, "r") as zip_ref:
82
119
  zip_ref.extractall(destination)
@@ -1,6 +1,9 @@
1
+ from typing import Optional
2
+
3
+
1
4
  class BadRequestException(Exception):
2
- def __init__(self, status_code, message=None):
3
- super(BadRequestException, self).__init__()
5
+ def __init__(self, status_code: int, message: Optional[str] = None):
6
+ super().__init__()
4
7
  self.status_code = status_code
5
8
  self.message = message
6
9
 
@@ -12,8 +15,8 @@ class BadRequestException(Exception):
12
15
 
13
16
 
14
17
  class ConfigurationException(Exception):
15
- def __init__(self, message=None):
16
- super(ConfigurationException, self).__init__()
18
+ def __init__(self, message: Optional[str] = None):
19
+ super().__init__()
17
20
  self.message = message
18
21
 
19
22
  def __str__(self):
@@ -247,9 +247,16 @@ def deploy_component(
247
247
  )
248
248
  component.workspace_fqn = workspace_fqn
249
249
  workspace_id = get_workspace_by_fqn(workspace_fqn).id
250
- updated_component = _handle_if_local_source(
251
- component=component, workspace_fqn=workspace_fqn
252
- )
250
+ if isinstance(component, auto_gen_models.ApplicationSet):
251
+ updated_component = component.copy(deep=True)
252
+ for i in range(len(updated_component.components)):
253
+ updated_component.components[i] = _handle_if_local_source(
254
+ component=component.components[i], workspace_fqn=workspace_fqn
255
+ )
256
+ else:
257
+ updated_component = _handle_if_local_source(
258
+ component=component, workspace_fqn=workspace_fqn
259
+ )
253
260
  client = ServiceFoundryServiceClient()
254
261
  response = client.deploy_application(
255
262
  workspace_id=workspace_id, application=updated_component
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: truefoundry
3
- Version: 0.3.0rc14
3
+ Version: 0.3.1
4
4
  Summary: Truefoundry CLI
5
5
  Author: Abhishek Choudhary
6
6
  Author-email: abhishek@truefoundry.com
@@ -58,7 +58,7 @@ truefoundry/deploy/cli/config.py,sha256=tf8w4UfVzcC6eYkENvuuCPYt_V3sqVpO1bclORV9
58
58
  truefoundry/deploy/cli/console.py,sha256=9-dMy4YPisCJQziRKTg8Qa0UJnOGl1soiUnJjsnLDvE,242
59
59
  truefoundry/deploy/cli/const.py,sha256=dVHPo1uAiDSSMXwXoT2mR5kNQjExT98QNVRz98Hz_Ts,510
60
60
  truefoundry/deploy/cli/display_util.py,sha256=gq8EBdpBMHUzYQp_hxOg9EOYi08FIHgOVFCqXqC2tuo,3044
61
- truefoundry/deploy/cli/util.py,sha256=HVcVsba5b4K2v4JQHFhNMhwIkVRlMTShQkjpOA38qxI,2526
61
+ truefoundry/deploy/cli/util.py,sha256=tSPYTQLSqEApx7nXxy69BTH69t4LewY1JtMJz5VEz40,3463
62
62
  truefoundry/deploy/core/__init__.py,sha256=j61bMWj4BkWihdssKMSFhieo7afJDtpc7qO7zk1rDB4,140
63
63
  truefoundry/deploy/core/login.py,sha256=N2VrW3nlBzoyoYulkipxwQvCpjBhi3sfsmhxK1ktWhg,236
64
64
  truefoundry/deploy/core/logout.py,sha256=TpWLq4_DsxYS5GX2OJQGDhekNOfiOLb-vO5khQueHXw,80
@@ -92,7 +92,7 @@ truefoundry/deploy/lib/dao/application.py,sha256=uUTFSQkLUrFCtQQgS2Jm9BpyHyhMkN4
92
92
  truefoundry/deploy/lib/dao/apply.py,sha256=sXnQY6RVzLVm1fX2BKuWHAoKlKISirrcByHEhY3x4zo,2570
93
93
  truefoundry/deploy/lib/dao/version.py,sha256=AtdW_4O1DPUKdfv2qy6iUJsZ_95vM6z0AqeEy3WDKs8,1130
94
94
  truefoundry/deploy/lib/dao/workspace.py,sha256=jm8UWytwVajVcrYyHSTCwWYDYl-RHuk0zAf9Caj4GzQ,2356
95
- truefoundry/deploy/lib/exceptions.py,sha256=ZW44bSwmlcr3GcB10E8Jz-zlgu9wyi8tE7xAFgul_7A,588
95
+ truefoundry/deploy/lib/exceptions.py,sha256=MNYmiEEHAKGVrpO66RBWcvvY6i3tctWJBYuodqAPJvc,604
96
96
  truefoundry/deploy/lib/logs_utils.py,sha256=SQxRv3jDDmgHdOUMhlMaAPGYskybnBUMpst7QU_i_sc,1469
97
97
  truefoundry/deploy/lib/messages.py,sha256=nhp0bCYf_XpUM68hTq5lBY-__vtEyV2uP7NgnJXJ_Vg,925
98
98
  truefoundry/deploy/lib/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -102,7 +102,7 @@ truefoundry/deploy/lib/util.py,sha256=sNMv9peDU7RTCDaAfyWPpPpCs_WcZGqOvc13Jqx9y6
102
102
  truefoundry/deploy/lib/win32.py,sha256=1RcvPTdlOAJ48rt8rCbE2Ufha2ztRqBAE9dueNXArrY,5009
103
103
  truefoundry/deploy/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
104
  truefoundry/deploy/v2/lib/__init__.py,sha256=WEiVMZXOVljzEE3tpGJil14liIn_PCDoACJ6b3tZ6sI,188
105
- truefoundry/deploy/v2/lib/deploy.py,sha256=vmaevT86nfrgephRjinhSVFEZHVc9R09vZBKKUoeUWI,11640
105
+ truefoundry/deploy/v2/lib/deploy.py,sha256=o0bOpXuYV9-AvyMaTYnPc3Gy3vjeN3ZP7F8r3nFzxjk,12001
106
106
  truefoundry/deploy/v2/lib/deploy_workflow.py,sha256=WhlrBuRf7r83qoQdTZSQzHt635fw9D4_qQIqusFWGag,12372
107
107
  truefoundry/deploy/v2/lib/deployable_patched_models.py,sha256=YVeTiasyf0s-QXjDqdvGSmN83oVAQ0h9g6F687PJyVI,3141
108
108
  truefoundry/deploy/v2/lib/models.py,sha256=pSolLMTArDuYpeNsmeeS5DWliloN_iCDfZSpRllMHUg,1120
@@ -130,7 +130,7 @@ truefoundry/workflow/map_task.py,sha256=2m3qGXQ90k9LdS45q8dqCCECc3qr8t2m_LMCVd1m
130
130
  truefoundry/workflow/python_task.py,sha256=SRXRLC4vdBqGjhkwuaY39LEWN6iPCpJAuW17URRdWTY,1128
131
131
  truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
132
132
  truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
133
- truefoundry-0.3.0rc14.dist-info/METADATA,sha256=VYMJcfmpfsg-A35fwDdJbd9vqYERPfaZmRMriY_-mt4,2694
134
- truefoundry-0.3.0rc14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
- truefoundry-0.3.0rc14.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
136
- truefoundry-0.3.0rc14.dist-info/RECORD,,
133
+ truefoundry-0.3.1.dist-info/METADATA,sha256=yVpfvpY3Hqp1pXxQ8XdDgSdpNle2XjHJYWFKVALUtSQ,2690
134
+ truefoundry-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
+ truefoundry-0.3.1.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
136
+ truefoundry-0.3.1.dist-info/RECORD,,