griptape-nodes 0.60.0__py3-none-any.whl → 0.60.2__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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  import asyncio
4
4
  import shutil
5
+ import stat
5
6
  import tarfile
6
7
  import tempfile
7
8
  from pathlib import Path
@@ -80,7 +81,7 @@ async def _sync_libraries(*, load_libraries_from_config: bool = True) -> None:
80
81
  if library_dir.is_dir():
81
82
  dest_library_dir = dest_nodes / library_dir.name
82
83
  if dest_library_dir.exists():
83
- shutil.rmtree(dest_library_dir)
84
+ shutil.rmtree(dest_library_dir, onexc=_remove_readonly)
84
85
  shutil.copytree(library_dir, dest_library_dir)
85
86
  console.print(f"[green]Synced library: {library_dir.name}[/green]")
86
87
 
@@ -94,3 +95,22 @@ async def _sync_libraries(*, load_libraries_from_config: bool = True) -> None:
94
95
  console.print(f"[red]Error initializing libraries: {e}[/red]")
95
96
 
96
97
  console.print("[bold green]Libraries synced.[/bold green]")
98
+
99
+
100
+ def _remove_readonly(func, path, excinfo) -> None: # noqa: ANN001, ARG001
101
+ """Handles read-only files and long paths on Windows during shutil.rmtree.
102
+
103
+ https://stackoverflow.com/a/50924863
104
+ """
105
+ if not GriptapeNodes.OSManager().is_windows():
106
+ return
107
+
108
+ long_path = Path(GriptapeNodes.OSManager().normalize_path_for_platform(path))
109
+
110
+ try:
111
+ Path.chmod(long_path, stat.S_IWRITE)
112
+ func(long_path)
113
+ except Exception as e:
114
+ console.print(f"[red]Error removing read-only file: {path}[/red]")
115
+ console.print(f"[red]Details: {e}[/red]")
116
+ raise
@@ -178,7 +178,7 @@ class OSManager:
178
178
  logger.debug(msg)
179
179
  return True, relative
180
180
 
181
- def _normalize_path_for_platform(self, path: Path) -> str:
181
+ def normalize_path_for_platform(self, path: Path) -> str:
182
182
  r"""Convert Path to string with Windows long path support if needed.
183
183
 
184
184
  Windows has a 260 character path limit (MAX_PATH). Paths longer than this
@@ -334,12 +334,12 @@ class OSManager:
334
334
  if self.is_windows():
335
335
  # Linter complains but this is the recommended way on Windows
336
336
  # We can ignore this warning as we've validated the path
337
- os.startfile(self._normalize_path_for_platform(path)) # noqa: S606 # pyright: ignore[reportAttributeAccessIssue]
337
+ os.startfile(self.normalize_path_for_platform(path)) # noqa: S606 # pyright: ignore[reportAttributeAccessIssue]
338
338
  logger.info("Opened path on Windows: %s", path)
339
339
  elif self.is_mac():
340
340
  # On macOS, open should be in a standard location
341
341
  subprocess.run( # noqa: S603
342
- ["/usr/bin/open", self._normalize_path_for_platform(path)],
342
+ ["/usr/bin/open", self.normalize_path_for_platform(path)],
343
343
  check=True, # Explicitly use check
344
344
  capture_output=True,
345
345
  text=True,
@@ -359,7 +359,7 @@ class OSManager:
359
359
  )
360
360
 
361
361
  subprocess.run( # noqa: S603
362
- [xdg_path, self._normalize_path_for_platform(path)],
362
+ [xdg_path, self.normalize_path_for_platform(path)],
363
363
  check=True, # Explicitly use check
364
364
  capture_output=True,
365
365
  text=True,
@@ -390,7 +390,7 @@ class OSManager:
390
390
  return None
391
391
 
392
392
  try:
393
- mime_type, _ = mimetypes.guess_type(self._normalize_path_for_platform(file_path), strict=True)
393
+ mime_type, _ = mimetypes.guess_type(self.normalize_path_for_platform(file_path), strict=True)
394
394
  if mime_type is None:
395
395
  mime_type = "text/plain"
396
396
  return mime_type # noqa: TRY300
@@ -553,7 +553,7 @@ class OSManager:
553
553
  file_size = file_path.stat().st_size
554
554
 
555
555
  # Determine MIME type and compression encoding
556
- normalized_path = self._normalize_path_for_platform(file_path)
556
+ normalized_path = self.normalize_path_for_platform(file_path)
557
557
  mime_type, compression_encoding = mimetypes.guess_type(normalized_path, strict=True)
558
558
  if mime_type is None:
559
559
  mime_type = "text/plain"
@@ -663,7 +663,7 @@ class OSManager:
663
663
  return WriteFileResultFailure(failure_reason=FileIOFailureReason.INVALID_PATH, result_details=msg)
664
664
 
665
665
  # Get normalized path for file operations (handles Windows long paths)
666
- normalized_path = self._normalize_path_for_platform(file_path)
666
+ normalized_path = self.normalize_path_for_platform(file_path)
667
667
 
668
668
  # Check if path is a directory (must check before attempting to write)
669
669
  try:
@@ -693,7 +693,7 @@ class OSManager:
693
693
  return WriteFileResultFailure(failure_reason=FileIOFailureReason.IO_ERROR, result_details=msg)
694
694
 
695
695
  # Check and create parent directory if needed
696
- parent_normalized = self._normalize_path_for_platform(file_path.parent)
696
+ parent_normalized = self.normalize_path_for_platform(file_path.parent)
697
697
  try:
698
698
  if not os.path.exists(parent_normalized): # noqa: PTH110
699
699
  if not request.create_parents:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: griptape-nodes
3
- Version: 0.60.0
3
+ Version: 0.60.2
4
4
  Summary: Add your description here
5
5
  Requires-Dist: griptape>=1.8.8
6
6
  Requires-Dist: pydantic>=2.10.6
@@ -27,7 +27,7 @@ griptape_nodes/cli/commands/__init__.py,sha256=8EbS15rm9xrbcPocuQO2RmOwSD1BBwa8i
27
27
  griptape_nodes/cli/commands/config.py,sha256=zh5rs2vCY_x9dEUK2jtQQJGcjlJzhpJJ-EgHHvkrvdg,2302
28
28
  griptape_nodes/cli/commands/engine.py,sha256=PWcjuhG_q6wnX1dZY1RJKvQQLO4CmMFBGyhOUKYOofE,2484
29
29
  griptape_nodes/cli/commands/init.py,sha256=JCI5dxvmPfeOiby33LXiEuLVtMGZlmpTGfpuE-a3FUo,27643
30
- griptape_nodes/cli/commands/libraries.py,sha256=XMTFbC_Ie95qSfemHg-HgQwWeYgBhFjr5GCOD7Iifec,3662
30
+ griptape_nodes/cli/commands/libraries.py,sha256=OW_ENwRsA9M715E97AE6O5fWpd4t72Cv7fv3g9LuSIM,4298
31
31
  griptape_nodes/cli/commands/models.py,sha256=txbozCLF_Hvj4q9g0P8gAi0ZfIFcL95Ad9QS_PfHiHY,17612
32
32
  griptape_nodes/cli/commands/self.py,sha256=aafOn1ThMxoRu2OvwqxAu0BuM_3vfB7e8_dOWeUpNZI,4021
33
33
  griptape_nodes/cli/main.py,sha256=A9k-4vdxOrm3Z0NNtDWLmvSW5ecvtIXInLR0zn2AERA,1739
@@ -137,7 +137,7 @@ griptape_nodes/retained_mode/managers/model_manager.py,sha256=Qc_FiqIJQ_ZuL5Yb7W
137
137
  griptape_nodes/retained_mode/managers/node_manager.py,sha256=p_Q9_JLnJ7Uz5VsSmuzKO34BYcEGMiQYN8I_p-Ca2lQ,184514
138
138
  griptape_nodes/retained_mode/managers/object_manager.py,sha256=w6T5UPUJRcYF90F1MuWhZVDgRrMc1uQ-6wt84Oz8OQA,12827
139
139
  griptape_nodes/retained_mode/managers/operation_manager.py,sha256=lTkMZlaacTgtV5oV-YF6HG8xsx9V_LwX1eg074WTs2k,20137
140
- griptape_nodes/retained_mode/managers/os_manager.py,sha256=Zq5hZqvt5rw8XH9Wuy4puW-Q3c6YbCZraQ1cTm7RhPM,54709
140
+ griptape_nodes/retained_mode/managers/os_manager.py,sha256=3v045dl38Eun5jPC7muNKt-0RfJCi2qqhRA9_cwqYTI,54701
141
141
  griptape_nodes/retained_mode/managers/resource_components/__init__.py,sha256=2FHpZFw2N1-oHfMCfrnB_XpF8_-2aSNtAZWh5zQTGL0,35
142
142
  griptape_nodes/retained_mode/managers/resource_components/capability_field.py,sha256=jZ5ONfdYVd5_MKlSKvUch1X2n1oHzMSeZW8UZ1a_RsU,1504
143
143
  griptape_nodes/retained_mode/managers/resource_components/comparator.py,sha256=02SiAiOatEnCgZOoMvpDhLsMpiOeNdtg9_HbrW4gS2k,609
@@ -195,7 +195,7 @@ griptape_nodes/version_compatibility/versions/v0_39_0/modified_parameters_set_re
195
195
  griptape_nodes/version_compatibility/workflow_versions/__init__.py,sha256=z5XDgkizoNByCXpyo34hfsJKFsWlOHbD6hgzfYH9ubc,52
196
196
  griptape_nodes/version_compatibility/workflow_versions/v0_7_0/__init__.py,sha256=IzPPmGK86h2swfGGTOHyVcBIlOng6SjgWQzlbf3ngmo,51
197
197
  griptape_nodes/version_compatibility/workflow_versions/v0_7_0/local_executor_argument_addition.py,sha256=Y8n1wzI5a-ZCHK5eiwtnnD3zF5lN-52R67rxYn0hxyI,2069
198
- griptape_nodes-0.60.0.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
199
- griptape_nodes-0.60.0.dist-info/entry_points.txt,sha256=qvevqd3BVbAV5TcantnAm0ouqaqYKhsRO3pkFymWLWM,82
200
- griptape_nodes-0.60.0.dist-info/METADATA,sha256=diiu5wfFAdS4NQbQtNgqvMkKkFmd_BCb9lk0tADIB6c,5108
201
- griptape_nodes-0.60.0.dist-info/RECORD,,
198
+ griptape_nodes-0.60.2.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
199
+ griptape_nodes-0.60.2.dist-info/entry_points.txt,sha256=qvevqd3BVbAV5TcantnAm0ouqaqYKhsRO3pkFymWLWM,82
200
+ griptape_nodes-0.60.2.dist-info/METADATA,sha256=c55vo2Sz17cN5Zyzv91zhDTItx7q5rtWlTBAecYvq6A,5108
201
+ griptape_nodes-0.60.2.dist-info/RECORD,,