truefoundry 0.3.0rc13__py3-none-any.whl → 0.3.0rc15__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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: truefoundry
3
- Version: 0.3.0rc13
3
+ Version: 0.3.0rc15
4
4
  Summary: Truefoundry CLI
5
5
  Author: Abhishek Choudhary
6
6
  Author-email: abhishek@truefoundry.com
@@ -24,7 +24,7 @@ Requires-Dist: flytekit (==1.12.2) ; extra == "workflow"
24
24
  Requires-Dist: gitignorefile (>=1.1.2,<1.2.0)
25
25
  Requires-Dist: importlib-metadata (>=6.0.1,<8.0.0)
26
26
  Requires-Dist: importlib-resources (>=5.2.0,<6.0.0)
27
- Requires-Dist: mlfoundry (==0.11.4) ; extra == "ml"
27
+ Requires-Dist: mlfoundry (==0.11.5) ; extra == "ml"
28
28
  Requires-Dist: openai (>=1.16.2,<2.0.0)
29
29
  Requires-Dist: packaging (>=20.0,<25.0)
30
30
  Requires-Dist: pydantic (>=1.10.0,<3)
@@ -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
@@ -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.0rc13.dist-info/METADATA,sha256=iWnUhwLSjjS0u5e5vLz1vq94H-8HXnFfnNJkQMpSB9U,2694
134
- truefoundry-0.3.0rc13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
- truefoundry-0.3.0rc13.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
136
- truefoundry-0.3.0rc13.dist-info/RECORD,,
133
+ truefoundry-0.3.0rc15.dist-info/METADATA,sha256=31ztTRk4oHRnyjZpc8yXiU_cDG2VfWOV6YfgZF-DRNw,2694
134
+ truefoundry-0.3.0rc15.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
135
+ truefoundry-0.3.0rc15.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
136
+ truefoundry-0.3.0rc15.dist-info/RECORD,,