uipath 2.1.128__py3-none-any.whl → 2.1.130__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 uipath might be problematic. Click here for more details.

@@ -23,6 +23,8 @@ from .._utils._constants import (
23
23
  from .._utils._project_files import ( # type: ignore
24
24
  FileInfo,
25
25
  FileOperationUpdate,
26
+ InteractiveConflictHandler,
27
+ compute_normalized_hash,
26
28
  files_to_include,
27
29
  read_toml_project,
28
30
  )
@@ -56,6 +58,7 @@ class SwFileHandler:
56
58
  project_id: str,
57
59
  directory: str,
58
60
  include_uv_lock: bool = True,
61
+ conflict_handler: Optional[InteractiveConflictHandler] = None,
59
62
  ) -> None:
60
63
  """Initialize the SwFileHandler.
61
64
 
@@ -63,12 +66,16 @@ class SwFileHandler:
63
66
  project_id: The ID of the UiPath project
64
67
  directory: Local project directory
65
68
  include_uv_lock: Whether to include uv.lock file
69
+ conflict_handler: Optional handler for file conflicts
66
70
  """
67
71
  self.directory = directory
68
72
  self.include_uv_lock = include_uv_lock
69
73
  self.console = ConsoleLogger()
70
74
  self._studio_client = StudioClient(project_id)
71
75
  self._project_structure: Optional[ProjectStructure] = None
76
+ self._conflict_handler = conflict_handler or InteractiveConflictHandler(
77
+ operation="push"
78
+ )
72
79
 
73
80
  def _get_folder_by_name(
74
81
  self, structure: ProjectStructure, folder_name: str
@@ -186,20 +193,78 @@ class SwFileHandler:
186
193
  )
187
194
 
188
195
  if remote_file:
189
- # File exists remotely - mark for update
196
+ # File exists remotely - check if content differs
190
197
  processed_source_files.add(remote_file.id)
191
- structural_migration.modified_resources.append(
192
- ModifiedResource(
193
- id=remote_file.id, content_file_path=local_file.file_path
198
+
199
+ # Download remote file and compare with local
200
+ try:
201
+ remote_response = (
202
+ await self._studio_client.download_project_file_async(
203
+ remote_file
204
+ )
194
205
  )
195
- )
196
- updates.append(
197
- FileOperationUpdate(
198
- file_path=local_file.file_path,
199
- status="updating",
200
- message=f"Updating '{local_file.file_name}'",
206
+ remote_content = remote_response.read().decode("utf-8")
207
+ remote_hash = compute_normalized_hash(remote_content)
208
+
209
+ with open(local_file.file_path, "r", encoding="utf-8") as f:
210
+ local_content = f.read()
211
+ local_hash = compute_normalized_hash(local_content)
212
+
213
+ # Only update if content differs and user confirms
214
+ if local_hash != remote_hash:
215
+ if self._conflict_handler.should_overwrite(
216
+ local_file.relative_path,
217
+ remote_hash,
218
+ local_hash,
219
+ local_full_path=os.path.abspath(local_file.file_path),
220
+ ):
221
+ structural_migration.modified_resources.append(
222
+ ModifiedResource(
223
+ id=remote_file.id,
224
+ content_file_path=local_file.file_path,
225
+ )
226
+ )
227
+ updates.append(
228
+ FileOperationUpdate(
229
+ file_path=local_file.file_path,
230
+ status="updating",
231
+ message=f"Updating '{local_file.file_name}'",
232
+ )
233
+ )
234
+ else:
235
+ updates.append(
236
+ FileOperationUpdate(
237
+ file_path=local_file.file_path,
238
+ status="skipped",
239
+ message=f"Skipped '{local_file.file_name}'",
240
+ )
241
+ )
242
+ else:
243
+ # Content is the same, no need to update
244
+ updates.append(
245
+ FileOperationUpdate(
246
+ file_path=local_file.file_path,
247
+ status="up_to_date",
248
+ message=f"File '{local_file.file_name}' is up to date",
249
+ )
250
+ )
251
+ except Exception as e:
252
+ logger.warning(
253
+ f"Failed to compare file '{local_file.file_path}': {e}"
254
+ )
255
+ # If comparison fails, proceed with update
256
+ structural_migration.modified_resources.append(
257
+ ModifiedResource(
258
+ id=remote_file.id, content_file_path=local_file.file_path
259
+ )
260
+ )
261
+ updates.append(
262
+ FileOperationUpdate(
263
+ file_path=local_file.file_path,
264
+ status="updating",
265
+ message=f"Updating '{local_file.file_name}'",
266
+ )
201
267
  )
202
- )
203
268
  else:
204
269
  # File doesn't exist remotely - mark for upload
205
270
  parent_path = os.path.dirname(local_file.relative_path)
@@ -741,7 +806,7 @@ class SwFileHandler:
741
806
  files[file.name] = file
742
807
  return files
743
808
 
744
- def _process_file_sync(
809
+ async def _process_file_sync(
745
810
  self,
746
811
  local_file_path: str,
747
812
  remote_files: Dict[str, ProjectFile],
@@ -766,10 +831,51 @@ class SwFileHandler:
766
831
 
767
832
  if remote_file:
768
833
  processed_ids.add(remote_file.id)
769
- structural_migration.modified_resources.append(
770
- ModifiedResource(id=remote_file.id, content_file_path=local_file_path)
771
- )
772
- self.console.info(f"Updating {click.style(destination, fg='yellow')}")
834
+
835
+ # Download remote file and compare with local
836
+ try:
837
+ remote_response = await self._studio_client.download_project_file_async(
838
+ remote_file
839
+ )
840
+ remote_content = remote_response.read().decode("utf-8")
841
+ remote_hash = compute_normalized_hash(remote_content)
842
+
843
+ with open(local_file_path, "r", encoding="utf-8") as f:
844
+ local_content = f.read()
845
+ local_hash = compute_normalized_hash(local_content)
846
+
847
+ # Only update if content differs and user confirms
848
+ if local_hash != remote_hash:
849
+ if self._conflict_handler.should_overwrite(
850
+ destination,
851
+ remote_hash,
852
+ local_hash,
853
+ local_full_path=os.path.abspath(local_file_path),
854
+ ):
855
+ structural_migration.modified_resources.append(
856
+ ModifiedResource(
857
+ id=remote_file.id, content_file_path=local_file_path
858
+ )
859
+ )
860
+ self.console.info(
861
+ f"Updating {click.style(destination, fg='yellow')}"
862
+ )
863
+ else:
864
+ self.console.info(
865
+ f"Skipped {click.style(destination, fg='bright_black')}"
866
+ )
867
+ else:
868
+ # Content is the same, no need to update
869
+ self.console.info(f"File '{destination}' is up to date")
870
+ except Exception as e:
871
+ logger.warning(f"Failed to compare file '{local_file_path}': {e}")
872
+ # If comparison fails, proceed with update
873
+ structural_migration.modified_resources.append(
874
+ ModifiedResource(
875
+ id=remote_file.id, content_file_path=local_file_path
876
+ )
877
+ )
878
+ self.console.info(f"Updating {click.style(destination, fg='yellow')}")
773
879
  else:
774
880
  structural_migration.added_resources.append(
775
881
  AddedResource(
@@ -870,7 +976,7 @@ class SwFileHandler:
870
976
  register_evaluator(evaluator.custom_evaluator_file_name)
871
977
  )
872
978
 
873
- self._process_file_sync(
979
+ await self._process_file_sync(
874
980
  evaluator_schema_file_path,
875
981
  remote_custom_evaluator_files,
876
982
  "coded-evals/evaluators/custom",
@@ -879,7 +985,7 @@ class SwFileHandler:
879
985
  processed_custom_evaluator_ids,
880
986
  )
881
987
 
882
- self._process_file_sync(
988
+ await self._process_file_sync(
883
989
  evaluator_types_file_path,
884
990
  remote_custom_evaluator_type_files,
885
991
  "coded-evals/evaluators/custom/types",
@@ -888,7 +994,7 @@ class SwFileHandler:
888
994
  processed_evaluator_type_ids,
889
995
  )
890
996
 
891
- self._process_file_sync(
997
+ await self._process_file_sync(
892
998
  evaluator.path,
893
999
  remote_evaluator_files,
894
1000
  "coded-evals/evaluators",
@@ -898,7 +1004,7 @@ class SwFileHandler:
898
1004
  )
899
1005
 
900
1006
  for eval_set_file in eval_set_files:
901
- self._process_file_sync(
1007
+ await self._process_file_sync(
902
1008
  eval_set_file,
903
1009
  remote_eval_set_files,
904
1010
  "coded-evals/eval-sets",
@@ -57,7 +57,11 @@ class FileConflictHandler(Protocol):
57
57
  """Protocol for handling file conflicts."""
58
58
 
59
59
  def should_overwrite(
60
- self, file_path: str, local_hash: str, remote_hash: str
60
+ self,
61
+ file_path: str,
62
+ local_hash: str,
63
+ remote_hash: str,
64
+ local_full_path: Optional[Path] = None,
61
65
  ) -> bool:
62
66
  """Return True to overwrite, False to skip."""
63
67
  ...
@@ -67,7 +71,11 @@ class AlwaysOverwriteHandler:
67
71
  """Handler that always overwrites files."""
68
72
 
69
73
  def should_overwrite(
70
- self, file_path: str, local_hash: str, remote_hash: str
74
+ self,
75
+ file_path: str,
76
+ local_hash: str,
77
+ remote_hash: str,
78
+ local_full_path: Optional[Path] = None,
71
79
  ) -> bool:
72
80
  return True
73
81
 
@@ -76,11 +84,73 @@ class AlwaysSkipHandler:
76
84
  """Handler that always skips conflicts."""
77
85
 
78
86
  def should_overwrite(
79
- self, file_path: str, local_hash: str, remote_hash: str
87
+ self,
88
+ file_path: str,
89
+ local_hash: str,
90
+ remote_hash: str,
91
+ local_full_path: Optional[Path] = None,
80
92
  ) -> bool:
81
93
  return False
82
94
 
83
95
 
96
+ class InteractiveConflictHandler:
97
+ """Handler that prompts the user for each conflict during pull or push operations.
98
+
99
+ Attributes:
100
+ operation: The operation type - either "pull" or "push"
101
+ """
102
+
103
+ def __init__(self, operation: Literal["pull", "push"]) -> None:
104
+ """Initialize the handler with an operation type.
105
+
106
+ Args:
107
+ operation: Either "pull" or "push" to determine the prompt message
108
+ """
109
+ self.operation = operation
110
+
111
+ def should_overwrite(
112
+ self,
113
+ file_path: str,
114
+ local_hash: str,
115
+ remote_hash: str,
116
+ local_full_path: Optional[Path] = None,
117
+ ) -> bool:
118
+ """Ask the user if they want to overwrite based on the operation.
119
+
120
+ Args:
121
+ file_path: Relative path to the file (for display)
122
+ local_hash: Hash of the local file content
123
+ remote_hash: Hash of the remote file content
124
+ local_full_path: Full path to the local file (unused, kept for protocol compatibility)
125
+
126
+ Returns:
127
+ True if the user wants to overwrite, False otherwise
128
+ """
129
+ import sys
130
+
131
+ import click
132
+
133
+ click.echo(
134
+ click.style(
135
+ f"\nFile '{file_path}' has different content on remote.",
136
+ fg="yellow",
137
+ )
138
+ )
139
+
140
+ # Prompt user for confirmation with operation-specific message
141
+ sys.stdout.flush()
142
+ if self.operation == "pull":
143
+ return click.confirm(
144
+ "Do you want to overwrite the local file with the remote version?",
145
+ default=False,
146
+ )
147
+ else: # push
148
+ return click.confirm(
149
+ "Do you want to push and overwrite the remote file with your local version?",
150
+ default=False,
151
+ )
152
+
153
+
84
154
  class FileInfo(BaseModel):
85
155
  """Information about a file to be included in the project.
86
156
 
@@ -608,7 +678,7 @@ async def download_folder_files(
608
678
 
609
679
  if local_hash != remote_hash:
610
680
  if conflict_handler.should_overwrite(
611
- file_path, local_hash, remote_hash
681
+ file_path, local_hash, remote_hash, local_path
612
682
  ):
613
683
  with open(local_path, "w", encoding="utf-8", newline="\n") as f:
614
684
  f.write(remote_content)
uipath/_cli/cli_pull.py CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  This module provides functionality to pull remote project files from a UiPath StudioWeb solution.
5
5
  It handles:
6
- - File downloads from source_code and evals folders
6
+ - File downloads from source_code and coded-evals folders
7
7
  - Maintaining folder structure locally
8
8
  - File comparison using hashes
9
9
  - Interactive confirmation for overwriting files
@@ -18,7 +18,11 @@ import click
18
18
  from .._config import UiPathConfig
19
19
  from ..telemetry import track
20
20
  from ._utils._console import ConsoleLogger
21
- from ._utils._project_files import ProjectPullError, pull_project
21
+ from ._utils._project_files import (
22
+ InteractiveConflictHandler,
23
+ ProjectPullError,
24
+ pull_project,
25
+ )
22
26
 
23
27
  console = ConsoleLogger()
24
28
 
@@ -34,7 +38,7 @@ def pull(root: Path) -> None:
34
38
  """Pull remote project files from Studio Web Project.
35
39
 
36
40
  This command pulls the remote project files from a UiPath Studio Web project.
37
- It downloads files from the source_code and evals folders, maintaining the
41
+ It downloads files from the source_code and coded-evals folders, maintaining the
38
42
  folder structure locally. Files are compared using hashes before overwriting,
39
43
  and user confirmation is required for differing files.
40
44
 
@@ -54,13 +58,18 @@ def pull(root: Path) -> None:
54
58
 
55
59
  download_configuration = {
56
60
  "source_code": root,
57
- "evals": root / "evals",
61
+ "coded-evals": root / "evals",
58
62
  }
59
63
 
64
+ # Create interactive conflict handler for user confirmation
65
+ conflict_handler = InteractiveConflictHandler(operation="pull")
66
+
60
67
  try:
61
68
 
62
69
  async def run_pull():
63
- async for update in pull_project(project_id, download_configuration):
70
+ async for update in pull_project(
71
+ project_id, download_configuration, conflict_handler
72
+ ):
64
73
  console.info(f"Processing: {update.file_path}")
65
74
  console.info(update.message)
66
75
 
@@ -2,7 +2,7 @@ import json
2
2
  import os
3
3
  from functools import wraps
4
4
  from importlib.metadata import version
5
- from logging import WARNING, LogRecord, getLogger
5
+ from logging import INFO, WARNING, LogRecord, getLogger
6
6
  from typing import Any, Callable, Dict, Optional, Union
7
7
 
8
8
  from azure.monitor.opentelemetry import configure_azure_monitor
@@ -104,7 +104,7 @@ class _TelemetryClient:
104
104
 
105
105
  getLogger("azure").setLevel(WARNING)
106
106
  _logger.addHandler(_AzureMonitorOpenTelemetryEventHandler())
107
- _logger.setLevel(WARNING)
107
+ _logger.setLevel(INFO)
108
108
 
109
109
  _TelemetryClient._initialized = True
110
110
  except Exception:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.1.128
3
+ Version: 2.1.130
4
4
  Summary: Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools.
5
5
  Project-URL: Homepage, https://uipath.com
6
6
  Project-URL: Repository, https://github.com/UiPath/uipath-python
@@ -17,7 +17,7 @@ uipath/_cli/cli_invoke.py,sha256=m-te-EjhDpk_fhFDkt-yQFzmjEHGo5lQDGEQWxSXisQ,439
17
17
  uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
18
18
  uipath/_cli/cli_pack.py,sha256=7mJgZahtpKM_4ZZEA3WNv61eJJeRwNv87FjBPmXRJ3c,11041
19
19
  uipath/_cli/cli_publish.py,sha256=DgyfcZjvfV05Ldy0Pk5y_Le_nT9JduEE_x-VpIc_Kq0,6471
20
- uipath/_cli/cli_pull.py,sha256=nV-OCdue_7C6x4f8jRoTYSnM-BgsWVsZUVibkgnogDU,2117
20
+ uipath/_cli/cli_pull.py,sha256=KgH4XYywcjTKZb5NtL4jeVxsCjy7g0ZopEmdYbgMGmQ,2361
21
21
  uipath/_cli/cli_push.py,sha256=5J-dhDilsYrlYg1aV1eWOU84QC_PlwTi9tI3UZptg1k,3743
22
22
  uipath/_cli/cli_register.py,sha256=5-Asb8DSTR4W6M3TDi4U-AKXYOCZ3l2vcTuMOybDHEo,1465
23
23
  uipath/_cli/cli_run.py,sha256=-pSuoPEfT-NzOmxLgNUtMvkYY-Lhk-dO5qv6UZkmkKU,4797
@@ -72,7 +72,7 @@ uipath/_cli/_evals/mocks/mocker_factory.py,sha256=A8XzDhJRKddUrGWmtp2FABd6d86VFd
72
72
  uipath/_cli/_evals/mocks/mockito_mocker.py,sha256=opwfELnvuh3krnPAg0MupkHTEmhCpQFhDVHLH-BH3BY,2683
73
73
  uipath/_cli/_evals/mocks/mocks.py,sha256=IrvhtTtIuU5geopvCRglNhxKoOcChnnjQZMoYygx0PU,2225
74
74
  uipath/_cli/_push/models.py,sha256=K3k6QUMkiNIb3M4U0EgDlKz1UELxeMXLNVAj3qyhZ4U,470
75
- uipath/_cli/_push/sw_file_handler.py,sha256=ivHj0qzCvEP45M3x-Oi2edO5I-uhyHzgnidDF3JRoTk,36192
75
+ uipath/_cli/_push/sw_file_handler.py,sha256=5pf8koOcmypR5BktDuvbAvMgTYQamnWGT-rmR568TTY,41361
76
76
  uipath/_cli/_runtime/_contracts.py,sha256=sVHUww13iFsB7tDkbmD4ki41xd6nbAoJkoc9BLiXEh8,36352
77
77
  uipath/_cli/_runtime/_escalation.py,sha256=x3vI98qsfRA-fL_tNkRVTFXioM5Gv2w0GFcXJJ5eQtg,7981
78
78
  uipath/_cli/_runtime/_hitl.py,sha256=JAwTUKvxO4HpnZMwE4E0AegAPw_uYOwgt0OYcu6EvTg,11474
@@ -95,7 +95,7 @@ uipath/_cli/_utils/_folders.py,sha256=RsYrXzF0NA1sPxgBoLkLlUY3jDNLg1V-Y8j71Q8a8H
95
95
  uipath/_cli/_utils/_input_args.py,sha256=AnbQ12D2ACIQFt0QHMaWleRn1ZgRTXuTSTN0ozJiSQg,5766
96
96
  uipath/_cli/_utils/_parse_ast.py,sha256=24YL28qK5Ss2O26IlzZ2FgEC_ZazXld_u3vkj8zVxGA,20933
97
97
  uipath/_cli/_utils/_processes.py,sha256=q7DfEKHISDWf3pngci5za_z0Pbnf_shWiYEcTOTCiyk,1855
98
- uipath/_cli/_utils/_project_files.py,sha256=i3F94aYekpM7PHVC3FrC1-lRBw-Tpe9XihN7pjCUkys,21812
98
+ uipath/_cli/_utils/_project_files.py,sha256=_Xbm4VPu2SoEemzwED5l75N930rPe6yPHi8BoeQXIy8,23868
99
99
  uipath/_cli/_utils/_resources.py,sha256=0MpEZWaY2oDDoxOVVTOXrTWpuwhQyypLcM8TgnXFQq0,577
100
100
  uipath/_cli/_utils/_studio_project.py,sha256=kEjCFyP-pm9mVOR-C-makoZ_vbgQRHfu8kRZfRsJino,26308
101
101
  uipath/_cli/_utils/_tracing.py,sha256=2igb03j3EHjF_A406UhtCKkPfudVfFPjUq5tXUEG4oo,1541
@@ -216,7 +216,7 @@ uipath/models/processes.py,sha256=bV31xTyF0hRWZmwy3bWj5L8dBD9wttWxfJjwzhjETmk,19
216
216
  uipath/models/queues.py,sha256=gnbeEyYlHtdqdxBalio0lw8mq-78YBG9MPMSkv1BWOg,6934
217
217
  uipath/telemetry/__init__.py,sha256=Wna32UFzZR66D-RzTKlPWlvji9i2HJb82NhHjCCXRjY,61
218
218
  uipath/telemetry/_constants.py,sha256=uRDuEZayBYtBA0tMx-2AS_D-oiVA7oKgp9zid9jNats,763
219
- uipath/telemetry/_track.py,sha256=3RZgJtY8y28Y5rfVmC432OyRu7N3pSxPouwa82KWFso,4787
219
+ uipath/telemetry/_track.py,sha256=7ZwEALrq2KpywWJZuRvzsH6vS5tvNytgjeiojnuPy7c,4790
220
220
  uipath/tracing/__init__.py,sha256=0oUuxJKOHE14iOL4SP93FOiEYRIFLTq-o0NwRcTB8Q4,317
221
221
  uipath/tracing/_otel_exporters.py,sha256=68wuAZyB_PScnSCW230PVs3qSqoJBNoArJJaE4UebNA,13956
222
222
  uipath/tracing/_traced.py,sha256=VAwEIfDHLx-AZ792SeGxCtOttEJXrLgI0YCkUMbxHsQ,20344
@@ -224,8 +224,8 @@ uipath/tracing/_utils.py,sha256=emsQRgYu-P1gj1q7XUPJD94mOa12JvhheRkuZJpLd9Y,1505
224
224
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
225
225
  uipath/utils/_endpoints_manager.py,sha256=tnF_FiCx8qI2XaJDQgYkMN_gl9V0VqNR1uX7iawuLp8,8230
226
226
  uipath/utils/dynamic_schema.py,sha256=ahgRLBWzuU0SQilaQVBJfBAVjimq3N3QJ1ztx0U_h2c,4943
227
- uipath-2.1.128.dist-info/METADATA,sha256=ue_yfY8MlN-zghxuxIlCR7pul3lCbAqL5xmXUMA8oUg,6626
228
- uipath-2.1.128.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
229
- uipath-2.1.128.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
230
- uipath-2.1.128.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
231
- uipath-2.1.128.dist-info/RECORD,,
227
+ uipath-2.1.130.dist-info/METADATA,sha256=KY-PNf2igP8YbbseNbnLV7q1qNcsGE4AsO3CxwF0kVM,6626
228
+ uipath-2.1.130.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
229
+ uipath-2.1.130.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
230
+ uipath-2.1.130.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
231
+ uipath-2.1.130.dist-info/RECORD,,