ygg 0.1.27__py3-none-any.whl → 0.1.29__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygg
3
- Version: 0.1.27
3
+ Version: 0.1.29
4
4
  Summary: Type-friendly utilities for moving data between Python objects, Arrow, Polars, Pandas, Spark, and Databricks
5
5
  Author: Yggdrasil contributors
6
6
  License: Apache License
@@ -1,9 +1,9 @@
1
- ygg-0.1.27.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
1
+ ygg-0.1.29.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
2
2
  yggdrasil/__init__.py,sha256=6OPibApplA5TF4TeixkQO_qewpaAidYX-fSDvvKYcTI,91
3
3
  yggdrasil/databricks/__init__.py,sha256=aGVve5mpoQtxSK2nfzrexjRPoutCIyaOnKZijkG4_QE,92
4
4
  yggdrasil/databricks/compute/__init__.py,sha256=TVDwPmW2SOmHmnhzZhsvrWbrxZ_lEcgqe3l9BeB-oxM,218
5
- yggdrasil/databricks/compute/cluster.py,sha256=91nBe_Ni0Yb4ECUU-YhSQeMVqy9VKhpWDAp771_1mxQ,28561
6
- yggdrasil/databricks/compute/execution_context.py,sha256=plutmNa03VSHlXbGeKArtc-QH9ptZrrnss2yXS2pFYA,18584
5
+ yggdrasil/databricks/compute/cluster.py,sha256=s2w2rn_7LNHCcYdcdsfDANDNNj78EwMMCiNa1PLJEhM,28521
6
+ yggdrasil/databricks/compute/execution_context.py,sha256=LiBq0rPfn3oqlYA031z765k54IApGgah5rEOL-m5v4s,18580
7
7
  yggdrasil/databricks/compute/remote.py,sha256=sVWBb_1YR-e33on6F5QYMLKwT6end6rolCvN8HM-9Qw,1212
8
8
  yggdrasil/databricks/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  yggdrasil/databricks/jobs/config.py,sha256=8Slfw4Wl7vu0kIlaUUqVqjjOgPwuULoo0rroENCbC20,11494
@@ -26,11 +26,11 @@ yggdrasil/libs/extensions/__init__.py,sha256=qkkRF1BQ_NLZlKeeZeeZDAbf9Q3wQXu5s4O
26
26
  yggdrasil/libs/extensions/polars_extensions.py,sha256=kojeJOW5VPBXMVTJT2gWUJypNuryq9ZeXmH-VZXgXoM,10531
27
27
  yggdrasil/libs/extensions/spark_extensions.py,sha256=uCcpLJr0wEE9V_-nc8DrQtAh9n2Q4mV_NicU-DNGG54,13396
28
28
  yggdrasil/pyutils/__init__.py,sha256=-aU5Y1huWoTLTPdSDxZM7QU0p0sTYj5j77cP833RsnQ,139
29
- yggdrasil/pyutils/callable_serde.py,sha256=6Pw9XO2JMUSmzGp1Vj3-AN1Nhave09fNWyn1xk_F6ow,18057
29
+ yggdrasil/pyutils/callable_serde.py,sha256=DmEn9j_FMQhd_qvG7Q2fvL8VBCaqgGK2mnaessMgJws,18056
30
30
  yggdrasil/pyutils/exceptions.py,sha256=Kt4xY4jPv-Ld8vBJaiQy51xbewD6Q-3bZkaa3THsFNM,2891
31
31
  yggdrasil/pyutils/modules.py,sha256=r3C4TRA8C_fUTltITV0VJY0pbIdxdV1op2z8BX0FgJo,10201
32
32
  yggdrasil/pyutils/parallel.py,sha256=L2r4_iumOzDk7omWVBPYmT5U8n7suOdv1AFpa_ghHSY,5902
33
- yggdrasil/pyutils/python_env.py,sha256=7Uwet9EQ7YZeVsvqS7A22C0NsiGtNTeAH0cyOXG89KE,49350
33
+ yggdrasil/pyutils/python_env.py,sha256=tQ1-CSxPzUIAbAkdZSyF93GQTTLsMYfavI0L08iaiYA,49398
34
34
  yggdrasil/pyutils/retry.py,sha256=1zjascEsffvnkVRdHhdeoenk6tBPrzrj4VhBltbhBeU,10390
35
35
  yggdrasil/requests/__init__.py,sha256=THJz1IoZYQccwmXcQR3N8D-uWxCkfMtgeXDhONdERR8,41
36
36
  yggdrasil/requests/msal.py,sha256=ucnN45iZZpbXkByw212PX4shH4g0EeyrW8JEmfimWtY,5861
@@ -49,8 +49,8 @@ yggdrasil/types/cast/registry.py,sha256=-88mq-U1pDSGbEC9PRY0zJCzloyBodXgeSRBPb6h
49
49
  yggdrasil/types/cast/spark_cast.py,sha256=IHthM78dugabGXxNNW9sSHn-olDwzXcFdIFcPo9IiXU,23021
50
50
  yggdrasil/types/cast/spark_pandas_cast.py,sha256=8PgJItF_XbyBcNuBnXkMQU3PBy3sAPEXZT9SXL2WbU4,4200
51
51
  yggdrasil/types/cast/spark_polars_cast.py,sha256=ba1UOvY1ouGCro1Np9slXmJ4TEyWnUtwVEAwxGvPLlk,8336
52
- ygg-0.1.27.dist-info/METADATA,sha256=wa7LF8bvOiQ5MWX9IwFFqDBxwVlB6bkebU6ZOGCr3Vs,19204
53
- ygg-0.1.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
- ygg-0.1.27.dist-info/entry_points.txt,sha256=D0JDw2s-ZfU1GjXfniv6PvXwcyn5v9WBk4ya623Cti8,71
55
- ygg-0.1.27.dist-info/top_level.txt,sha256=iBe9Kk4VIVbLpgv_p8OZUIfxgj4dgJ5wBg6vO3rigso,10
56
- ygg-0.1.27.dist-info/RECORD,,
52
+ ygg-0.1.29.dist-info/METADATA,sha256=H9-xKVaADfcI7Euov960Egc5LI70k2gPw4-vzGE0ZZA,19204
53
+ ygg-0.1.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
+ ygg-0.1.29.dist-info/entry_points.txt,sha256=6q-vpWG3kvw2dhctQ0LALdatoeefkN855Ev02I1dKGY,70
55
+ ygg-0.1.29.dist-info/top_level.txt,sha256=iBe9Kk4VIVbLpgv_p8OZUIfxgj4dgJ5wBg6vO3rigso,10
56
+ ygg-0.1.29.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ yggenv = yggdrasil.pyutils.python_env:PythonEnv.cli
@@ -135,7 +135,7 @@ class Cluster(WorkspaceService):
135
135
  )
136
136
 
137
137
  return inst
138
-
138
+
139
139
  def push_python_environment(
140
140
  self,
141
141
  source: Optional[PythonEnv] = None,
@@ -179,6 +179,7 @@ class Cluster(WorkspaceService):
179
179
 
180
180
  def pull_python_environment(
181
181
  self,
182
+ name: Optional[str] = None,
182
183
  target: Optional[PythonEnv] = None,
183
184
  ):
184
185
  with self.context() as c:
@@ -186,15 +187,18 @@ class Cluster(WorkspaceService):
186
187
  requirements = m.requirements
187
188
  version_info = m.version_info
188
189
 
190
+ python_version = ".".join(str(_) for _ in version_info)
191
+
189
192
  if target is None:
190
193
  target = PythonEnv.create(
191
- name=f"dbx-{self.name}",
192
- python=".".join(str(_) for _ in version_info)
194
+ name=name or self.name,
195
+ requirements=requirements,
196
+ python=python_version
193
197
  )
194
198
  else:
195
199
  target.update(
196
200
  requirements=requirements,
197
- python=".".join(str(_) for _ in version_info)
201
+ python=python_version,
198
202
  )
199
203
 
200
204
  return target
@@ -642,7 +646,6 @@ class Cluster(WorkspaceService):
642
646
  self,
643
647
  _func: Optional[Callable] = None,
644
648
  *,
645
- before: Optional[Callable] = None,
646
649
  language: Optional["Language"] = None,
647
650
  env_keys: Optional[List[str]] = None,
648
651
  env_variables: Optional[Dict[str, str]] = None,
@@ -669,15 +672,12 @@ class Cluster(WorkspaceService):
669
672
  def decorator(func: Callable):
670
673
  context = self.context(language=language or Language.PYTHON)
671
674
  serialized = CallableSerde.from_callable(func)
672
- do_before = CallableSerde.from_callable(before)
673
675
 
674
676
  @functools.wraps(func)
675
677
  def wrapper(*args, **kwargs):
676
678
  if os.getenv("DATABRICKS_RUNTIME_VERSION") is not None:
677
679
  return func(*args, **kwargs)
678
680
 
679
- do_before()
680
-
681
681
  return context.execute(
682
682
  obj=serialized,
683
683
  args=list(args),
@@ -291,7 +291,7 @@ print(json.dumps(meta))"""
291
291
 
292
292
  serialized = CallableSerde.from_callable(func)
293
293
 
294
- self.install_temporary_libraries(libraries=serialized.package_root)
294
+ self.install_temporary_libraries(libraries=serialized.pkg_root)
295
295
 
296
296
  # Use dill of same version
297
297
  current_version = (sys.version_info.major, sys.version_info.minor)
@@ -7,7 +7,6 @@ import inspect
7
7
  import json
8
8
  import struct
9
9
  import sys
10
- import textwrap
11
10
  import zlib
12
11
  from dataclasses import dataclass
13
12
  from pathlib import Path
@@ -46,7 +45,7 @@ def _find_pkg_root_from_file(file_path: Path) -> Optional[Path]:
46
45
  top_pkg_dir = d
47
46
  d = d.parent
48
47
 
49
- return top_pkg_dir.parent if top_pkg_dir else None
48
+ return top_pkg_dir if top_pkg_dir else None
50
49
 
51
50
 
52
51
  def _callable_file_line(fn: Callable[..., Any]) -> Tuple[Optional[str], Optional[int]]:
@@ -248,7 +247,10 @@ class CallableSerde:
248
247
  def from_callable(cls: type[T], x: Union[Callable[..., Any], T]) -> T:
249
248
  if isinstance(x, cls):
250
249
  return x
251
- return cls(fn=x) # type: ignore[return-value]
250
+
251
+ obj = cls(fn=x) # type: ignore[return-value]
252
+
253
+ return obj
252
254
 
253
255
  # ----- lazy-ish properties (computed on access) -----
254
256
 
@@ -509,7 +509,9 @@ class PythonEnv:
509
509
 
510
510
  py = str(Path(python).expanduser()) if isinstance(python, Path) else str(python)
511
511
  log.info("creating env: name=%s root=%s python=%s", name, str(root), py)
512
- _run_cmd([uv, "venv", str(root), "--python", py], cwd=cwd, env=env, check=check)
512
+ _run_cmd([
513
+ uv, "venv", str(root), "--python", py, "--native-tls"
514
+ ], cwd=cwd, env=env, check=check)
513
515
 
514
516
  env_obj = cls(root)
515
517
  if not env_obj.exists():
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- ygg-env = yggdrasil.pyutils.python_env:PythonEnv.cli
File without changes