truefoundry 0.10.4rc2__py3-none-any.whl → 0.10.4rc4__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.

@@ -2,7 +2,7 @@ import ast
2
2
  import io
3
3
  import json
4
4
  import re
5
- from typing import Dict, List, Optional
5
+ from typing import Any, Callable, Dict, List, Optional
6
6
 
7
7
  from rich.console import Console
8
8
  from rich.pretty import pprint
@@ -17,7 +17,7 @@ def generate_deployment_code(
17
17
  spec_repr: str,
18
18
  workspace_fqn: str,
19
19
  ):
20
- symbols = ",".join(symbols_to_import)
20
+ symbols = ", ".join(symbols_to_import)
21
21
  application_type = application_type.replace(" ", "").replace("-", "_")
22
22
  code = f"""\
23
23
  import logging
@@ -72,7 +72,7 @@ def remove_none_type_fields(code):
72
72
 
73
73
  def remove_type_field(code):
74
74
  lines = code.split("\n")
75
- new_lines = [re.sub(r'^[ \t]*type=[\'"][^"]*[\'"],', "", line) for line in lines]
75
+ new_lines = [re.sub(r'^[ \t]*type=[\'"][^"]*[\'"],?', "", line) for line in lines]
76
76
  return "\n".join(new_lines)
77
77
 
78
78
 
@@ -143,15 +143,39 @@ def _convert_deployment_config_to_python(workspace_fqn: str, application_spec: d
143
143
  return generated_code
144
144
 
145
145
 
146
- def convert_deployment_config_to_python(workspace_fqn: str, application_spec: dict):
146
+ def _default_exclude_fn(model: BaseModel, name: str) -> bool:
147
+ return False
148
+
149
+
150
+ def convert_deployment_config_to_python(
151
+ workspace_fqn: str,
152
+ application_spec: Dict[str, Any],
153
+ exclude_fn: Callable[[BaseModel, str], bool] = _default_exclude_fn,
154
+ exclude_unset: bool = False,
155
+ exclude_defaults: bool = False,
156
+ ):
147
157
  original_repr_args = BaseModel.__repr_args__
148
158
 
149
159
  def _patched_repr_args(self: BaseModel):
150
- return [
151
- (name, value)
152
- for name, value in original_repr_args(self)
153
- if name in self.__fields_set__
154
- ]
160
+ _missing = object()
161
+ pairs = []
162
+ for name, value in original_repr_args(self):
163
+ if name is not None:
164
+ if exclude_fn(self, name):
165
+ continue
166
+ if exclude_unset and name not in self.__fields_set__:
167
+ continue
168
+ model_field = self.__fields__.get(name)
169
+ if model_field is None:
170
+ continue
171
+ if (
172
+ exclude_defaults
173
+ and not getattr(model_field, "required", True)
174
+ and getattr(model_field, "default", _missing) == value
175
+ ):
176
+ continue
177
+ pairs.append((name, value))
178
+ return pairs
155
179
 
156
180
  try:
157
181
  BaseModel.__repr_args__ = _patched_repr_args
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truefoundry
3
- Version: 0.10.4rc2
3
+ Version: 0.10.4rc4
4
4
  Summary: TrueFoundry CLI
5
5
  Author-email: TrueFoundry Team <abhishek@truefoundry.com>
6
6
  Requires-Python: <3.14,>=3.8.1
@@ -53,7 +53,7 @@ truefoundry/common/types.py,sha256=BMJFCsR1lPJAw66IQBSvLyV4I6o_x5oj78gVsUa9si8,1
53
53
  truefoundry/common/utils.py,sha256=j3QP0uOsaGD_VmDDR68JTwoYE1okkAq6OqpVkzVf48Q,6424
54
54
  truefoundry/common/warnings.py,sha256=rs6BHwk7imQYedo07iwh3TWEOywAR3Lqhj0AY4khByg,504
55
55
  truefoundry/deploy/__init__.py,sha256=2GNbI8IGJBotz_IKaqQ-DWYWZn_pSu7lN7aId15Gk7Q,2799
56
- truefoundry/deploy/python_deploy_codegen.py,sha256=CNL1633k84Mg4hUk2azc88TrQwRWEON0f2Y8V3SGuoM,7173
56
+ truefoundry/deploy/python_deploy_codegen.py,sha256=k19_m5DGsUyjOUCSKwIVP8vDna2sq01tHABsUfoVpW4,8019
57
57
  truefoundry/deploy/_autogen/models.py,sha256=xt-DuaRDx5jeRwyGoQH2yyPZAep9Q2MHFW9XBuRzG8E,73161
58
58
  truefoundry/deploy/builder/__init__.py,sha256=kgvlkVkiWpMVdim81tIeLrdoACqrFDgwCqHdQVsCsMo,4988
59
59
  truefoundry/deploy/builder/constants.py,sha256=amUkHoHvVKzGv0v_knfiioRuKiJM0V0xW0diERgWiI0,508
@@ -381,7 +381,7 @@ truefoundry/workflow/remote_filesystem/__init__.py,sha256=LQ95ViEjJ7Ts4JcCGOxMPs
381
381
  truefoundry/workflow/remote_filesystem/logger.py,sha256=em2l7D6sw7xTLDP0kQSLpgfRRCLpN14Qw85TN7ujQcE,1022
382
382
  truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=xcT0wQmQlgzcj0nP3tJopyFSVWT1uv3nhiTIuwfXYeg,12342
383
383
  truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=nSGPZu0Gyd_jz0KsEE-7w_BmnTD8CVF1S8cUJoxaCbc,13305
384
- truefoundry-0.10.4rc2.dist-info/METADATA,sha256=SJpxZlTvIDJc5NOKQZdbj-K4z1tv0Dqct9vdAwYuKYw,2508
385
- truefoundry-0.10.4rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
386
- truefoundry-0.10.4rc2.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
387
- truefoundry-0.10.4rc2.dist-info/RECORD,,
384
+ truefoundry-0.10.4rc4.dist-info/METADATA,sha256=5AJCpFRmPJFEZb9YerIsMFvC5Dq_Sr3YJPJlh3Ea3IQ,2508
385
+ truefoundry-0.10.4rc4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
386
+ truefoundry-0.10.4rc4.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
387
+ truefoundry-0.10.4rc4.dist-info/RECORD,,