ygg 0.1.26__py3-none-any.whl → 0.1.28__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.
- {ygg-0.1.26.dist-info → ygg-0.1.28.dist-info}/METADATA +1 -1
- {ygg-0.1.26.dist-info → ygg-0.1.28.dist-info}/RECORD +10 -10
- ygg-0.1.28.dist-info/entry_points.txt +2 -0
- yggdrasil/databricks/compute/cluster.py +8 -4
- yggdrasil/databricks/workspaces/databricks_path.py +66 -36
- yggdrasil/pyutils/callable_serde.py +30 -1
- yggdrasil/pyutils/python_env.py +3 -1
- ygg-0.1.26.dist-info/entry_points.txt +0 -2
- {ygg-0.1.26.dist-info → ygg-0.1.28.dist-info}/WHEEL +0 -0
- {ygg-0.1.26.dist-info → ygg-0.1.28.dist-info}/licenses/LICENSE +0 -0
- {ygg-0.1.26.dist-info → ygg-0.1.28.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
ygg-0.1.
|
|
1
|
+
ygg-0.1.28.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=
|
|
5
|
+
yggdrasil/databricks/compute/cluster.py,sha256=ziQFDQC0xjVytNDvtQZa9iy9SGCkSsEf85RF3zSZwAE,28657
|
|
6
6
|
yggdrasil/databricks/compute/execution_context.py,sha256=plutmNa03VSHlXbGeKArtc-QH9ptZrrnss2yXS2pFYA,18584
|
|
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
|
|
@@ -13,7 +13,7 @@ yggdrasil/databricks/sql/exceptions.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
13
13
|
yggdrasil/databricks/sql/statement_result.py,sha256=L-hrK5MVnH3XG57BpGmaETtRzYjAtYGQthgAPGVj618,12610
|
|
14
14
|
yggdrasil/databricks/sql/types.py,sha256=YgasSyq8sygk1h6ZOTcRwXAZWNKSuk-9g9VqlR8kJl4,5324
|
|
15
15
|
yggdrasil/databricks/workspaces/__init__.py,sha256=tNNS3A_Pl9FYkQ8nGERhr4VF-hwKrvh8k1W8vTaR0uo,58
|
|
16
|
-
yggdrasil/databricks/workspaces/databricks_path.py,sha256=
|
|
16
|
+
yggdrasil/databricks/workspaces/databricks_path.py,sha256=xqK-dMMZJ0JE58FfKa5j6b-6owbSeeisPF8L4efV35E,32473
|
|
17
17
|
yggdrasil/databricks/workspaces/workspace.py,sha256=8T-d0DTq-s2zTkmMbaEeS_7AiZwcUDxorch9IbZACko,33333
|
|
18
18
|
yggdrasil/dataclasses/__init__.py,sha256=QVAvZnNl7gFYTLOVTfMkdQZf6o_WL8_UuDV1uTZ7Aeg,67
|
|
19
19
|
yggdrasil/dataclasses/dataclass.py,sha256=ln-D1-bbiCLBd2khRMGs4dFoxzJEEGzHTKekWCnF2uk,5436
|
|
@@ -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=
|
|
29
|
+
yggdrasil/pyutils/callable_serde.py,sha256=y3736Lot1m2c824Nc_YY3KGaCc5VC4k4n5xdq8g1rXU,19163
|
|
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=
|
|
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.
|
|
53
|
-
ygg-0.1.
|
|
54
|
-
ygg-0.1.
|
|
55
|
-
ygg-0.1.
|
|
56
|
-
ygg-0.1.
|
|
52
|
+
ygg-0.1.28.dist-info/METADATA,sha256=7pGg7X4ChK2dkLlXc7LI3RItrEqpoNKKJFsbgJY2Nz4,19204
|
|
53
|
+
ygg-0.1.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
54
|
+
ygg-0.1.28.dist-info/entry_points.txt,sha256=6q-vpWG3kvw2dhctQ0LALdatoeefkN855Ev02I1dKGY,70
|
|
55
|
+
ygg-0.1.28.dist-info/top_level.txt,sha256=iBe9Kk4VIVbLpgv_p8OZUIfxgj4dgJ5wBg6vO3rigso,10
|
|
56
|
+
ygg-0.1.28.dist-info/RECORD,,
|
|
@@ -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=
|
|
192
|
-
|
|
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=
|
|
201
|
+
python=python_version,
|
|
198
202
|
)
|
|
199
203
|
|
|
200
204
|
return target
|
|
@@ -108,34 +108,6 @@ class DatabricksPath(SysPath, PurePosixPath):
|
|
|
108
108
|
|
|
109
109
|
return str(PurePosixPath(*(_seg_to_str(s) for s in pathsegments)))
|
|
110
110
|
|
|
111
|
-
def _init(self, template: Optional["DatabricksPath"] = None) -> None:
|
|
112
|
-
"""
|
|
113
|
-
pathlib creates derived paths (parent, /, joinpath, with_name, etc.) via _from_parts
|
|
114
|
-
which bypasses __new__. _init(template=...) is the hook to carry our metadata forward.
|
|
115
|
-
"""
|
|
116
|
-
if isinstance(template, DatabricksPath):
|
|
117
|
-
# Recompute kind for the NEW path string (don’t blindly copy _kind)
|
|
118
|
-
temp_ws = getattr(template, "_workspace", None)
|
|
119
|
-
kind, ws, _ = DatabricksPathKind.parse(str(self), workspace=temp_ws)
|
|
120
|
-
|
|
121
|
-
self._kind = kind
|
|
122
|
-
self._workspace = ws if ws is not None else temp_ws
|
|
123
|
-
|
|
124
|
-
# Never inherit caches from template
|
|
125
|
-
self._is_file = None
|
|
126
|
-
self._is_dir = None
|
|
127
|
-
self._raw_status = None
|
|
128
|
-
self._raw_status_refresh_time = 0.0
|
|
129
|
-
else:
|
|
130
|
-
kind, ws, _ = DatabricksPathKind.parse(str(self))
|
|
131
|
-
self._kind = kind
|
|
132
|
-
self._workspace = ws
|
|
133
|
-
|
|
134
|
-
self._is_file = None
|
|
135
|
-
self._is_dir = None
|
|
136
|
-
self._raw_status = None
|
|
137
|
-
self._raw_status_refresh_time = 0.0
|
|
138
|
-
|
|
139
111
|
def __new__(
|
|
140
112
|
cls,
|
|
141
113
|
*pathsegments: Any,
|
|
@@ -195,16 +167,74 @@ class DatabricksPath(SysPath, PurePosixPath):
|
|
|
195
167
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
196
168
|
return self.workspace.__exit__(exc_type, exc_val, exc_tb)
|
|
197
169
|
|
|
198
|
-
def
|
|
199
|
-
|
|
170
|
+
def _clone_meta_from(self, template: "DatabricksPath") -> None:
|
|
171
|
+
"""
|
|
172
|
+
Copy *connection/meta* state, but never copy caches.
|
|
173
|
+
Centralizes the logic so every creation path stays consistent.
|
|
174
|
+
"""
|
|
175
|
+
# Keep workspace threading; kind should match the NEW path string.
|
|
176
|
+
kind, ws, _ = DatabricksPathKind.parse(str(self), workspace=getattr(template, "_workspace", None))
|
|
177
|
+
self._kind = kind
|
|
178
|
+
self._workspace = ws if ws is not None else getattr(template, "_workspace", None)
|
|
200
179
|
|
|
201
|
-
|
|
202
|
-
|
|
180
|
+
# Reset caches
|
|
181
|
+
self._is_file = None
|
|
182
|
+
self._is_dir = None
|
|
183
|
+
self._raw_status = None
|
|
184
|
+
self._raw_status_refresh_time = 0.0
|
|
203
185
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
built
|
|
207
|
-
|
|
186
|
+
@property
|
|
187
|
+
def parent(self):
|
|
188
|
+
built = super().parent
|
|
189
|
+
|
|
190
|
+
built._clone_meta_from(self)
|
|
191
|
+
|
|
192
|
+
return built
|
|
193
|
+
|
|
194
|
+
@classmethod
|
|
195
|
+
def _from_parsed_parts(cls, drv, root, parts):
|
|
196
|
+
"""
|
|
197
|
+
pathlib internal factory. It may pass a template in some Python versions,
|
|
198
|
+
but if not, we still return a valid DatabricksPath with initialized state.
|
|
199
|
+
"""
|
|
200
|
+
built = super()._from_parsed_parts(drv, root, parts) # type: ignore[misc]
|
|
201
|
+
|
|
202
|
+
# Best effort: if pathlib gave us a template on the object, use it.
|
|
203
|
+
# Otherwise ensure we at least have valid defaults.
|
|
204
|
+
if isinstance(built, DatabricksPath) and isinstance(getattr(built, "_workspace", None), object):
|
|
205
|
+
# If the object already has workspace/kind via _init, don't stomp it.
|
|
206
|
+
# But if it's missing _kind (common failure), derive it.
|
|
207
|
+
if not hasattr(built, "_kind"):
|
|
208
|
+
kind, ws, _ = DatabricksPathKind.parse(str(built), workspace=getattr(built, "_workspace", None))
|
|
209
|
+
built._kind = kind
|
|
210
|
+
built._workspace = ws if ws is not None else getattr(built, "_workspace", None)
|
|
211
|
+
|
|
212
|
+
# Always reset caches (derived path => cache invalid)
|
|
213
|
+
built._is_file = None
|
|
214
|
+
built._is_dir = None
|
|
215
|
+
built._raw_status = None
|
|
216
|
+
built._raw_status_refresh_time = 0.0
|
|
217
|
+
else:
|
|
218
|
+
# Safety defaults (should be rare)
|
|
219
|
+
kind, ws, _ = DatabricksPathKind.parse(str(built))
|
|
220
|
+
built._kind = kind
|
|
221
|
+
built._workspace = ws
|
|
222
|
+
built._is_file = None
|
|
223
|
+
built._is_dir = None
|
|
224
|
+
built._raw_status = None
|
|
225
|
+
built._raw_status_refresh_time = 0.0
|
|
226
|
+
|
|
227
|
+
return built
|
|
228
|
+
|
|
229
|
+
def _make_child(self, args):
|
|
230
|
+
built = super()._make_child(args) # type: ignore[misc]
|
|
231
|
+
|
|
232
|
+
# Ensure type + meta carryover
|
|
233
|
+
if isinstance(built, DatabricksPath):
|
|
234
|
+
built._clone_meta_from(self)
|
|
235
|
+
else:
|
|
236
|
+
# if for some reason super didn't return our type, try to coerce
|
|
237
|
+
built = type(self)(built, workspace=getattr(self, "_workspace", None))
|
|
208
238
|
|
|
209
239
|
return built
|
|
210
240
|
|
|
@@ -242,13 +242,42 @@ class CallableSerde:
|
|
|
242
242
|
_env_b64: Optional[str] = None
|
|
243
243
|
_env_meta: Optional[Dict[str, Any]] = None
|
|
244
244
|
|
|
245
|
+
def __post_init__(self) -> None:
|
|
246
|
+
# If constructed as CallableSerde(fn=...), eagerly capture backing metadata.
|
|
247
|
+
if self.fn is not None:
|
|
248
|
+
self._init_private_from_fn(self.fn)
|
|
249
|
+
|
|
250
|
+
def _init_private_from_fn(self, fn: Callable[..., Any]) -> None:
|
|
251
|
+
"""
|
|
252
|
+
Capture stable identity-ish metadata at creation time, so we don't rely
|
|
253
|
+
on lazy properties later (or after fn is dropped).
|
|
254
|
+
"""
|
|
255
|
+
# Only set if not already provided (don't clobber loaded/explicit values).
|
|
256
|
+
if self._module is None:
|
|
257
|
+
self._module = getattr(fn, "__module__", None)
|
|
258
|
+
|
|
259
|
+
if self._qualname is None:
|
|
260
|
+
self._qualname = getattr(fn, "__qualname__", None)
|
|
261
|
+
|
|
262
|
+
if self._pkg_root is None:
|
|
263
|
+
f, _ = _callable_file_line(fn)
|
|
264
|
+
if f:
|
|
265
|
+
root = _find_pkg_root_from_file(Path(f))
|
|
266
|
+
if root:
|
|
267
|
+
self._pkg_root = str(root)
|
|
268
|
+
|
|
245
269
|
# ----- construction -----
|
|
246
270
|
|
|
247
271
|
@classmethod
|
|
248
272
|
def from_callable(cls: type[T], x: Union[Callable[..., Any], T]) -> T:
|
|
249
273
|
if isinstance(x, cls):
|
|
250
274
|
return x
|
|
251
|
-
|
|
275
|
+
|
|
276
|
+
obj = cls(fn=x) # type: ignore[return-value]
|
|
277
|
+
# __post_init__ already ran, but this keeps it robust if dataclass changes.
|
|
278
|
+
obj._init_private_from_fn(x)
|
|
279
|
+
|
|
280
|
+
return obj
|
|
252
281
|
|
|
253
282
|
# ----- lazy-ish properties (computed on access) -----
|
|
254
283
|
|
yggdrasil/pyutils/python_env.py
CHANGED
|
@@ -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([
|
|
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():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|