flyte 0.2.0b28__py3-none-any.whl → 0.2.0b31__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 flyte might be problematic. Click here for more details.

flyte/_image.py CHANGED
@@ -195,6 +195,15 @@ class WorkDir(Layer):
195
195
  hasher.update(self.workdir.encode("utf-8"))
196
196
 
197
197
 
198
+ @rich.repr.auto
199
+ @dataclass(frozen=True, repr=True)
200
+ class DockerIgnore(Layer):
201
+ path: str
202
+
203
+ def update_hash(self, hasher: hashlib._Hash):
204
+ hasher.update(self.path.encode("utf-8"))
205
+
206
+
198
207
  @rich.repr.auto
199
208
  @dataclass(frozen=True, repr=True)
200
209
  class CopyConfig(Layer):
@@ -778,6 +787,10 @@ class Image:
778
787
  new_image = self.clone(addl_layer=CopyConfig(path_type=0, src=src, dst=dst, _compute_identifier=lambda x: dst))
779
788
  return new_image
780
789
 
790
+ def with_dockerignore(self, path: Path) -> Image:
791
+ new_image = self.clone(addl_layer=DockerIgnore(path=str(path)))
792
+ return new_image
793
+
781
794
  def with_uv_project(
782
795
  self,
783
796
  pyproject_file: Path,
@@ -15,6 +15,7 @@ from flyte._image import (
15
15
  AptPackages,
16
16
  Commands,
17
17
  CopyConfig,
18
+ DockerIgnore,
18
19
  Env,
19
20
  Image,
20
21
  Layer,
@@ -205,12 +206,18 @@ class UVProjectHandler:
205
206
  return dockerfile
206
207
 
207
208
 
209
+ class DockerIgnoreHandler:
210
+ @staticmethod
211
+ async def handle(layer: DockerIgnore, context_path: Path, _: str):
212
+ shutil.copy(layer.path, context_path)
213
+
214
+
208
215
  class CopyConfigHandler:
209
216
  @staticmethod
210
217
  async def handle(layer: CopyConfig, context_path: Path, dockerfile: str) -> str:
211
218
  # Copy the source config file or directory to the context path
212
219
  if layer.src.is_absolute() or ".." in str(layer.src):
213
- dst_path = context_path / str(layer.src.absolute()).replace("/", "./_flyte_abs_context/")
220
+ dst_path = context_path / str(layer.src.absolute()).replace("/", "./_flyte_abs_context/", 1)
214
221
  else:
215
222
  dst_path = context_path / layer.src
216
223
 
@@ -276,6 +283,10 @@ async def _process_layer(layer: Layer, context_path: Path, dockerfile: str) -> s
276
283
  # Handle commands
277
284
  dockerfile = await CommandsHandler.handle(layer, context_path, dockerfile)
278
285
 
286
+ case DockerIgnore():
287
+ # Handle dockerignore
288
+ await DockerIgnoreHandler.handle(layer, context_path, dockerfile)
289
+
279
290
  case WorkDir():
280
291
  # Handle workdir
281
292
  dockerfile = await WorkDirHandler.handle(layer, context_path, dockerfile)
@@ -16,6 +16,7 @@ from flyte._image import (
16
16
  Architecture,
17
17
  Commands,
18
18
  CopyConfig,
19
+ DockerIgnore,
19
20
  Env,
20
21
  PipPackages,
21
22
  PythonWheels,
@@ -225,6 +226,8 @@ def _get_layers_proto(image: Image, context_path: Path) -> "image_definition_pb2
225
226
  commands=image_definition_pb2.Commands(cmd=list(layer.commands))
226
227
  )
227
228
  layers.append(commands_layer)
229
+ elif isinstance(layer, DockerIgnore):
230
+ shutil.copy(layer.path, context_path)
228
231
  elif isinstance(layer, CopyConfig):
229
232
  dst_path = _copy_files_to_context(layer.src, context_path)
230
233
 
flyte/_logging.py CHANGED
@@ -83,7 +83,7 @@ def get_default_handler(log_level: int) -> logging.Handler:
83
83
  return handler
84
84
 
85
85
 
86
- def initialize_logger(log_level: int = DEFAULT_LOG_LEVEL, enable_rich: bool = False):
86
+ def initialize_logger(log_level: int = get_env_log_level(), enable_rich: bool = False):
87
87
  """
88
88
  Initializes the global loggers to the default configuration.
89
89
  """
flyte/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.2.0b28'
21
- __version_tuple__ = version_tuple = (0, 2, 0, 'b28')
20
+ __version__ = version = '0.2.0b31'
21
+ __version_tuple__ = version_tuple = (0, 2, 0, 'b31')
@@ -1594,6 +1594,18 @@ class UnionTransformer(TypeTransformer[T]):
1594
1594
  self, python_val: T, python_type: Type[T], expected: types_pb2.LiteralType
1595
1595
  ) -> literals_pb2.Literal:
1596
1596
  python_type = get_underlying_type(python_type)
1597
+ inferred_type = type(python_val)
1598
+ subtypes = get_args(python_type)
1599
+
1600
+ if inferred_type in subtypes:
1601
+ # If the Python value's type matches one of the types in the Union,
1602
+ # always use the transformer associated with that specific type.
1603
+ transformer = TypeEngine.get_transformer(inferred_type)
1604
+ res = await transformer.to_literal(
1605
+ python_val, inferred_type, expected.union_type.variants[subtypes.index(inferred_type)]
1606
+ )
1607
+ res_type = _add_tag_to_type(transformer.get_literal_type(inferred_type), transformer.name)
1608
+ return Literal(scalar=Scalar(union=Union(value=res, type=res_type)))
1597
1609
 
1598
1610
  potential_types = []
1599
1611
  found_res = False
@@ -1601,14 +1613,14 @@ class UnionTransformer(TypeTransformer[T]):
1601
1613
  res = None
1602
1614
  res_type = None
1603
1615
  t = None
1604
- for i in range(len(get_args(python_type))):
1616
+ for i in range(len(subtypes)):
1605
1617
  try:
1606
- t = get_args(python_type)[i]
1618
+ t = subtypes[i]
1607
1619
  trans: TypeTransformer[T] = TypeEngine.get_transformer(t)
1608
1620
  attempt = trans.to_literal(python_val, t, expected.union_type.variants[i])
1609
1621
  res = await attempt
1610
1622
  if found_res:
1611
- logger.debug(f"Current type {get_args(python_type)[i]} old res {res_type}")
1623
+ logger.debug(f"Current type {subtypes[i]} old res {res_type}")
1612
1624
  is_ambiguous = True
1613
1625
  res_type = _add_tag_to_type(trans.get_literal_type(t), trans.name)
1614
1626
  found_res = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyte
3
- Version: 0.2.0b28
3
+ Version: 0.2.0b31
4
4
  Summary: Add your description here
5
5
  Author-email: Ketan Umare <kumare3@users.noreply.github.com>
6
6
  Requires-Python: >=3.10
@@ -8,10 +8,10 @@ flyte/_environment.py,sha256=oKVXLBX0ky2eE_wjBdzvQGI_2LiT2Nbx58ur7GMt50c,3231
8
8
  flyte/_excepthook.py,sha256=nXts84rzEg6-7RtFarbKzOsRZTQR4plnbWVIFMAEprs,1310
9
9
  flyte/_group.py,sha256=7o1j16sZyUmYB50mOiq1ui4TBAKhRpDqLakV8Ya1kw4,803
10
10
  flyte/_hash.py,sha256=Of_Zl_DzzzF2jp4ZsLm-3o-xJFCCJ8_GubmLI1htx78,504
11
- flyte/_image.py,sha256=RIjkZrj4q0-KVpYW_Z0Zd14Rn9WIQqOPG6DUGDH0ZKo,33258
11
+ flyte/_image.py,sha256=NbHR_4pCpYVwd7gYW1CHaXm6cxVhAR40NFDy3QaiLbU,33604
12
12
  flyte/_initialize.py,sha256=xKl_LYMluRt21wWqa6RTKuLo0_DCbSaTfUk27_brtNk,18232
13
13
  flyte/_interface.py,sha256=1B9zIwFDjiVp_3l_mk8EpA4g3Re-6DUBEBi9z9vDvPs,3504
14
- flyte/_logging.py,sha256=_yNo-Nx2yzh0MLoZGbnIYHGKei4wtQmSGM0lE30Ev7w,3662
14
+ flyte/_logging.py,sha256=QrT4Z30C2tsZ-yIojisQODTuq6Y6zSJYuTrLgF58UYc,3664
15
15
  flyte/_map.py,sha256=efPd8O-JKUg1OY3_MzU3KGbhsGYDVRNBwWr0ceNIXhQ,7444
16
16
  flyte/_pod.py,sha256=--72b0c6IkOEbBwZPLmgl-ll-j7ECfG-kh75LzBnNN8,1068
17
17
  flyte/_resources.py,sha256=L2JuvQDlMo1JLJeUmJPRwtWbunhR2xJEhFgQW5yc72c,9690
@@ -25,7 +25,7 @@ flyte/_task_plugins.py,sha256=9MH3nFPOH_e8_92BT4sFk4oyAnj6GJFvaPYWaraX7yE,1037
25
25
  flyte/_timeout.py,sha256=zx5sFcbYmjJAJbZWSGzzX-BpC9HC7Jfs35T7vVhKwkk,1571
26
26
  flyte/_tools.py,sha256=tWb0sx3t3mm4jbaQVjCTc9y39oR_Ibo3z_KHToP3Lto,966
27
27
  flyte/_trace.py,sha256=C788bgoSc3st8kE8Cae2xegnLx2CT6uuRKKfaDrDUys,5122
28
- flyte/_version.py,sha256=17NKFMLoy5Yz1urofNe-xHRTlzSKuLO6mP2yK1P7AxI,521
28
+ flyte/_version.py,sha256=-611dm8Aue-6mBwOfXD5A1a_8Mu4J5-SG4njsMhco3s,521
29
29
  flyte/errors.py,sha256=IUXHuEgszis9ZyhBUOSSlZx7VPQk0BF4N875yj1FBKo,4963
30
30
  flyte/extend.py,sha256=GB4ZedGzKa30vYWRVPOdxEeK62xnUVFY4z2tD6H9eEw,376
31
31
  flyte/models.py,sha256=g8QBIF9JjrNxDR_R_esAFG72hrq3fFV42bb7Nm0E0Zo,15225
@@ -53,9 +53,9 @@ flyte/_internal/controllers/remote/_core.py,sha256=FJe1ZAWu_0w5SQUFgAHY4Hjjf_Aju
53
53
  flyte/_internal/controllers/remote/_informer.py,sha256=StiPcQLLW0h36uEBhKsupMY79EeFCKA3QQzvv2IyvRo,14188
54
54
  flyte/_internal/controllers/remote/_service_protocol.py,sha256=B9qbIg6DiGeac-iSccLmX_AL2xUgX4ezNUOiAbSy4V0,1357
55
55
  flyte/_internal/imagebuild/__init__.py,sha256=dwXdJ1jMhw9RF8itF7jkPLanvX1yCviSns7hE5eoIts,102
56
- flyte/_internal/imagebuild/docker_builder.py,sha256=idA3HNmYrsX0qaYjmiJVJEuwYYjZfYoIEMB7aogwWYs,16468
56
+ flyte/_internal/imagebuild/docker_builder.py,sha256=SZdQOaNwnXwHeCzcg7YdnmveypeLXGRiIEN3VzhqR-Q,16795
57
57
  flyte/_internal/imagebuild/image_builder.py,sha256=dXBXl62qcPabus6dR3eP8P9mBGNhpZHZ2Xm12AymKkk,11150
58
- flyte/_internal/imagebuild/remote_builder.py,sha256=JBeek4B4a6tUeyAD8dgQKVv4myMdeERqmxMStABVWN0,10452
58
+ flyte/_internal/imagebuild/remote_builder.py,sha256=NndHL4dHKMIb8s4RS1fllr7oCtwbzZI0OufGNSLr14M,10566
59
59
  flyte/_internal/resolvers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  flyte/_internal/resolvers/_task_module.py,sha256=jwy1QYygUK7xmpCZLt1SPTfJCkfox3Ck3mTlTsm66UI,1973
61
61
  flyte/_internal/resolvers/common.py,sha256=ADQLRoyGsJ4vuUkitffMGrMKKjy0vpk6X53g4FuKDLc,993
@@ -224,11 +224,11 @@ flyte/types/_interface.py,sha256=5y9EC5r897xz03Hh0ltF8QVGKMfMfAznws-hKSEO4Go,167
224
224
  flyte/types/_pickle.py,sha256=PjdR66OTDMZ3OYq6GvM_Ua0cIo5t2XQaIjmpJ9xo4Ys,4050
225
225
  flyte/types/_renderer.py,sha256=ygcCo5l60lHufyQISFddZfWwLlQ8kJAKxUT_XnR_6dY,4818
226
226
  flyte/types/_string_literals.py,sha256=NlG1xV8RSA-sZ-n-IFQCAsdB6jXJOAKkHWtnopxVVDk,4231
227
- flyte/types/_type_engine.py,sha256=QBH-XNwyBHvKP8PjI_BaEPneonfoeNS86aMld87YLMA,97278
227
+ flyte/types/_type_engine.py,sha256=9cgkE_gz4gFfuXc2Qy7cLEmf2p1ZJb2DhygK_PaiqOs,97934
228
228
  flyte/types/_utils.py,sha256=pbts9E1_2LTdLygAY0UYTLYJ8AsN3BZyviSXvrtcutc,2626
229
- flyte-0.2.0b28.data/scripts/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
230
- flyte-0.2.0b28.dist-info/METADATA,sha256=EL-2mFQ2imGb8w-oib02h7qXZdE1Pcen75jRIeiJSyI,5857
231
- flyte-0.2.0b28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
232
- flyte-0.2.0b28.dist-info/entry_points.txt,sha256=MIq2z5dBurdCJfpXfMKzgBv7sJOakKRYxr8G0cMiTrg,75
233
- flyte-0.2.0b28.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
234
- flyte-0.2.0b28.dist-info/RECORD,,
229
+ flyte-0.2.0b31.data/scripts/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
230
+ flyte-0.2.0b31.dist-info/METADATA,sha256=IJffB3F_KtRiGCVSvKg33LxXaMRAKMvOpxw7H9e5KxM,5857
231
+ flyte-0.2.0b31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
232
+ flyte-0.2.0b31.dist-info/entry_points.txt,sha256=MIq2z5dBurdCJfpXfMKzgBv7sJOakKRYxr8G0cMiTrg,75
233
+ flyte-0.2.0b31.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
234
+ flyte-0.2.0b31.dist-info/RECORD,,