ygg 0.1.25__tar.gz → 0.1.27__tar.gz

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.
Files changed (61) hide show
  1. {ygg-0.1.25 → ygg-0.1.27}/PKG-INFO +1 -1
  2. {ygg-0.1.25 → ygg-0.1.27}/pyproject.toml +1 -1
  3. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/PKG-INFO +1 -1
  4. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/sql/engine.py +1 -2
  5. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/workspaces/databricks_path.py +94 -44
  6. {ygg-0.1.25 → ygg-0.1.27}/LICENSE +0 -0
  7. {ygg-0.1.25 → ygg-0.1.27}/README.md +0 -0
  8. {ygg-0.1.25 → ygg-0.1.27}/setup.cfg +0 -0
  9. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/SOURCES.txt +0 -0
  10. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/dependency_links.txt +0 -0
  11. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/entry_points.txt +0 -0
  12. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/requires.txt +0 -0
  13. {ygg-0.1.25 → ygg-0.1.27}/src/ygg.egg-info/top_level.txt +0 -0
  14. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/__init__.py +0 -0
  15. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/__init__.py +0 -0
  16. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/compute/__init__.py +0 -0
  17. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/compute/cluster.py +0 -0
  18. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/compute/execution_context.py +0 -0
  19. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/compute/remote.py +0 -0
  20. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/jobs/__init__.py +0 -0
  21. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/jobs/config.py +0 -0
  22. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/sql/__init__.py +0 -0
  23. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/sql/exceptions.py +0 -0
  24. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/sql/statement_result.py +0 -0
  25. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/sql/types.py +0 -0
  26. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/workspaces/__init__.py +0 -0
  27. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/databricks/workspaces/workspace.py +0 -0
  28. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/dataclasses/__init__.py +0 -0
  29. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/dataclasses/dataclass.py +0 -0
  30. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/__init__.py +0 -0
  31. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/databrickslib.py +0 -0
  32. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/extensions/__init__.py +0 -0
  33. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/extensions/polars_extensions.py +0 -0
  34. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/extensions/spark_extensions.py +0 -0
  35. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/pandaslib.py +0 -0
  36. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/polarslib.py +0 -0
  37. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/libs/sparklib.py +0 -0
  38. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/__init__.py +0 -0
  39. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/callable_serde.py +0 -0
  40. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/exceptions.py +0 -0
  41. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/modules.py +0 -0
  42. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/parallel.py +0 -0
  43. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/python_env.py +0 -0
  44. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/pyutils/retry.py +0 -0
  45. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/requests/__init__.py +0 -0
  46. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/requests/msal.py +0 -0
  47. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/requests/session.py +0 -0
  48. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/__init__.py +0 -0
  49. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/__init__.py +0 -0
  50. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/arrow_cast.py +0 -0
  51. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/cast_options.py +0 -0
  52. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/pandas_cast.py +0 -0
  53. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/polars_cast.py +0 -0
  54. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/polars_pandas_cast.py +0 -0
  55. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/registry.py +0 -0
  56. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/spark_cast.py +0 -0
  57. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/spark_pandas_cast.py +0 -0
  58. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/cast/spark_polars_cast.py +0 -0
  59. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/libs.py +0 -0
  60. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/python_arrow.py +0 -0
  61. {ygg-0.1.25 → ygg-0.1.27}/src/yggdrasil/types/python_defaults.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygg
3
- Version: 0.1.25
3
+ Version: 0.1.27
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ygg"
7
- version = "0.1.25"
7
+ version = "0.1.27"
8
8
  description = "Type-friendly utilities for moving data between Python objects, Arrow, Polars, Pandas, Spark, and Databricks"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = { file = "LICENSE" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygg
3
- Version: 0.1.25
3
+ Version: 0.1.27
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
@@ -439,8 +439,7 @@ FROM parquet.`{databricks_tmp_folder}`"""
439
439
  try:
440
440
  databricks_tmp_folder.rmdir(recursive=True)
441
441
  except Exception as e:
442
- raise e
443
- logger.error(e)
442
+ logger.warning(e)
444
443
 
445
444
  # Optionally run OPTIMIZE / ZORDER / VACUUM if requested (Databricks SQL)
446
445
  if zorder_by:
@@ -108,33 +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
- kind, ws, _ = DatabricksPathKind.parse(str(self), workspace=getattr(template, "_workspace", None))
119
-
120
- self._kind = kind
121
- self._workspace = ws if ws is not None else getattr(template, "_workspace", None)
122
-
123
- # Never inherit caches from template
124
- self._is_file = None
125
- self._is_dir = None
126
- self._raw_status = None
127
- self._raw_status_refresh_time = 0.0
128
- else:
129
- kind, ws, _ = DatabricksPathKind.parse(str(self))
130
- self._kind = kind
131
- self._workspace = ws
132
-
133
- self._is_file = None
134
- self._is_dir = None
135
- self._raw_status = None
136
- self._raw_status_refresh_time = 0.0
137
-
138
111
  def __new__(
139
112
  cls,
140
113
  *pathsegments: Any,
@@ -171,6 +144,22 @@ class DatabricksPath(SysPath, PurePosixPath):
171
144
  # pathlib paths are effectively immutable; all init happens in __new__ / _init
172
145
  pass
173
146
 
147
+ def __truediv__(self, other):
148
+ if not other:
149
+ return self
150
+
151
+ built = super().__truediv__(other)
152
+
153
+ built._kind = self._kind
154
+ built._workspace = self._workspace
155
+
156
+ built._is_file = None
157
+ built._is_dir = None
158
+ built._raw_status = None
159
+ built._raw_status_refresh_time = 0.0
160
+
161
+ return built
162
+
174
163
  def __enter__(self):
175
164
  self.workspace.__enter__()
176
165
  return self
@@ -178,32 +167,92 @@ class DatabricksPath(SysPath, PurePosixPath):
178
167
  def __exit__(self, exc_type, exc_val, exc_tb):
179
168
  return self.workspace.__exit__(exc_type, exc_val, exc_tb)
180
169
 
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)
179
+
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
185
+
181
186
  @property
182
- def workspace(self):
183
- try:
184
- if self._workspace is None:
185
- from .workspace import Workspace
187
+ def parent(self):
188
+ built = super().parent
186
189
 
187
- self._workspace = Workspace()
188
- except AttributeError:
189
- self._init(template=self)
190
+ built._clone_meta_from(self)
190
191
 
191
- from .workspace import Workspace
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))
192
238
 
193
- if self._workspace is None:
194
- from .workspace import Workspace
239
+ return built
195
240
 
196
- self._workspace = Workspace()
241
+ @property
242
+ def workspace(self):
243
+ if self._workspace is None:
244
+ from .workspace import Workspace
197
245
 
246
+ self._workspace = Workspace()
198
247
  return self._workspace
199
248
 
249
+ @workspace.setter
250
+ def workspace(self, value):
251
+ self._workspace = value
252
+
200
253
  @property
201
254
  def kind(self):
202
- try:
203
- return self._kind
204
- except AttributeError:
205
- self._init(template=self)
206
- return self._kind
255
+ return self._kind
207
256
 
208
257
  @kind.setter
209
258
  def kind(self, value: DatabricksPathKind):
@@ -606,7 +655,8 @@ class DatabricksPath(SysPath, PurePosixPath):
606
655
 
607
656
  try:
608
657
  # FIX: DBFS listing should use DBFS-normalized path, not workspace path
609
- for info in sdk.dbfs.list(self.as_dbfs_api_path(), recursive=recursive):
658
+ p = "/dbfs/" + self.as_dbfs_api_path() + "/"
659
+ for info in sdk.dbfs.list(p, recursive=recursive):
610
660
  base = DatabricksPath(
611
661
  info.path,
612
662
  workspace=self.workspace,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes