uipath 2.1.85__py3-none-any.whl → 2.1.86__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.
- uipath/_cli/_utils/_project_files.py +122 -0
- uipath/_cli/cli_pull.py +11 -151
- {uipath-2.1.85.dist-info → uipath-2.1.86.dist-info}/METADATA +1 -1
- {uipath-2.1.85.dist-info → uipath-2.1.86.dist-info}/RECORD +7 -7
- {uipath-2.1.85.dist-info → uipath-2.1.86.dist-info}/WHEEL +0 -0
- {uipath-2.1.85.dist-info → uipath-2.1.86.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.85.dist-info → uipath-2.1.86.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
# type: ignore
|
|
2
|
+
import hashlib
|
|
2
3
|
import json
|
|
3
4
|
import os
|
|
4
5
|
import re
|
|
6
|
+
from pathlib import Path
|
|
5
7
|
from typing import Any, Dict, Optional, Tuple
|
|
6
8
|
|
|
9
|
+
import click
|
|
7
10
|
from pydantic import BaseModel
|
|
8
11
|
|
|
9
12
|
from .._utils._console import ConsoleLogger
|
|
10
13
|
from ._constants import is_binary_file
|
|
14
|
+
from ._studio_project import (
|
|
15
|
+
ProjectFile,
|
|
16
|
+
ProjectFolder,
|
|
17
|
+
StudioClient,
|
|
18
|
+
get_folder_by_name,
|
|
19
|
+
)
|
|
11
20
|
|
|
12
21
|
try:
|
|
13
22
|
import tomllib
|
|
@@ -431,3 +440,116 @@ def files_to_include(
|
|
|
431
440
|
)
|
|
432
441
|
)
|
|
433
442
|
return extra_files
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def compute_normalized_hash(content: str) -> str:
|
|
446
|
+
"""Compute hash of normalized content.
|
|
447
|
+
|
|
448
|
+
Args:
|
|
449
|
+
content: Content to hash
|
|
450
|
+
|
|
451
|
+
Returns:
|
|
452
|
+
str: SHA256 hash of the normalized content
|
|
453
|
+
"""
|
|
454
|
+
try:
|
|
455
|
+
# Try to parse as JSON to handle formatting
|
|
456
|
+
json_content = json.loads(content)
|
|
457
|
+
normalized = json.dumps(json_content, indent=2)
|
|
458
|
+
except json.JSONDecodeError:
|
|
459
|
+
# Not JSON, normalize line endings
|
|
460
|
+
normalized = content.replace("\r\n", "\n").replace("\r", "\n")
|
|
461
|
+
|
|
462
|
+
return hashlib.sha256(normalized.encode("utf-8")).hexdigest()
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def collect_files_from_folder(
|
|
466
|
+
folder: ProjectFolder, base_path: str, files_dict: Dict[str, ProjectFile]
|
|
467
|
+
) -> None:
|
|
468
|
+
"""Recursively collect all files from a folder and its subfolders.
|
|
469
|
+
|
|
470
|
+
Args:
|
|
471
|
+
folder: The folder to collect files from
|
|
472
|
+
base_path: Base path for file paths
|
|
473
|
+
files_dict: Dictionary to store collected files
|
|
474
|
+
"""
|
|
475
|
+
# Add files from current folder
|
|
476
|
+
for file in folder.files:
|
|
477
|
+
file_path = os.path.join(base_path, file.name)
|
|
478
|
+
files_dict[file_path] = file
|
|
479
|
+
|
|
480
|
+
# Recursively process subfolders
|
|
481
|
+
for subfolder in folder.folders:
|
|
482
|
+
subfolder_path = os.path.join(base_path, subfolder.name)
|
|
483
|
+
collect_files_from_folder(subfolder, subfolder_path, files_dict)
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
async def download_folder_files(
|
|
487
|
+
studio_client: StudioClient,
|
|
488
|
+
folder: ProjectFolder,
|
|
489
|
+
base_path: Path,
|
|
490
|
+
) -> None:
|
|
491
|
+
"""Download files from a folder recursively.
|
|
492
|
+
|
|
493
|
+
Args:
|
|
494
|
+
studio_client: Studio client
|
|
495
|
+
folder: The folder to download files from
|
|
496
|
+
base_path: Base path for local file storage
|
|
497
|
+
"""
|
|
498
|
+
files_dict: Dict[str, ProjectFile] = {}
|
|
499
|
+
collect_files_from_folder(folder, "", files_dict)
|
|
500
|
+
for file_path, remote_file in files_dict.items():
|
|
501
|
+
local_path = base_path / file_path
|
|
502
|
+
local_path.parent.mkdir(parents=True, exist_ok=True)
|
|
503
|
+
|
|
504
|
+
# Download remote file
|
|
505
|
+
response = await studio_client.download_file_async(remote_file.id)
|
|
506
|
+
remote_content = response.read().decode("utf-8")
|
|
507
|
+
remote_hash = compute_normalized_hash(remote_content)
|
|
508
|
+
|
|
509
|
+
if os.path.exists(local_path):
|
|
510
|
+
# Read and hash local file
|
|
511
|
+
with open(local_path, "r", encoding="utf-8") as f:
|
|
512
|
+
local_content = f.read()
|
|
513
|
+
local_hash = compute_normalized_hash(local_content)
|
|
514
|
+
|
|
515
|
+
# Compare hashes
|
|
516
|
+
if local_hash != remote_hash:
|
|
517
|
+
styled_path = click.style(str(file_path), fg="cyan")
|
|
518
|
+
console.warning(f"File {styled_path}" + " differs from remote version.")
|
|
519
|
+
response = click.prompt("Do you want to overwrite it? (y/n)", type=str)
|
|
520
|
+
if response.lower() == "y":
|
|
521
|
+
with open(local_path, "w", encoding="utf-8", newline="\n") as f:
|
|
522
|
+
f.write(remote_content)
|
|
523
|
+
console.success(f"Updated {click.style(str(file_path), fg='cyan')}")
|
|
524
|
+
else:
|
|
525
|
+
console.info(f"Skipped {click.style(str(file_path), fg='cyan')}")
|
|
526
|
+
else:
|
|
527
|
+
console.info(
|
|
528
|
+
f"File {click.style(str(file_path), fg='cyan')} is up to date"
|
|
529
|
+
)
|
|
530
|
+
else:
|
|
531
|
+
# File doesn't exist locally, create it
|
|
532
|
+
with open(local_path, "w", encoding="utf-8", newline="\n") as f:
|
|
533
|
+
f.write(remote_content)
|
|
534
|
+
console.success(f"Downloaded {click.style(str(file_path), fg='cyan')}")
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
async def pull_project(project_id: str, download_configuration: dict[str, Path]):
|
|
538
|
+
studio_client = StudioClient(project_id)
|
|
539
|
+
|
|
540
|
+
with console.spinner("Pulling UiPath project files..."):
|
|
541
|
+
try:
|
|
542
|
+
structure = await studio_client.get_project_structure_async()
|
|
543
|
+
for source_key, destination in download_configuration.items():
|
|
544
|
+
source_folder = get_folder_by_name(structure, source_key)
|
|
545
|
+
if source_folder:
|
|
546
|
+
await download_folder_files(
|
|
547
|
+
studio_client,
|
|
548
|
+
source_folder,
|
|
549
|
+
destination,
|
|
550
|
+
)
|
|
551
|
+
else:
|
|
552
|
+
console.warning(f"No {source_key} folder found in remote project")
|
|
553
|
+
|
|
554
|
+
except Exception as e:
|
|
555
|
+
console.error(f"Failed to pull UiPath project: {str(e)}")
|
uipath/_cli/cli_pull.py
CHANGED
|
@@ -11,133 +11,27 @@ It handles:
|
|
|
11
11
|
|
|
12
12
|
# type: ignore
|
|
13
13
|
import asyncio
|
|
14
|
-
import hashlib
|
|
15
|
-
import json
|
|
16
14
|
import os
|
|
17
|
-
from
|
|
15
|
+
from pathlib import Path
|
|
18
16
|
|
|
19
17
|
import click
|
|
20
18
|
|
|
21
19
|
from ..telemetry import track
|
|
22
20
|
from ._utils._console import ConsoleLogger
|
|
23
21
|
from ._utils._constants import UIPATH_PROJECT_ID
|
|
24
|
-
from ._utils.
|
|
25
|
-
ProjectFile,
|
|
26
|
-
ProjectFolder,
|
|
27
|
-
StudioClient,
|
|
28
|
-
get_folder_by_name,
|
|
29
|
-
)
|
|
22
|
+
from ._utils._project_files import pull_project
|
|
30
23
|
|
|
31
24
|
console = ConsoleLogger()
|
|
32
25
|
|
|
33
26
|
|
|
34
|
-
def compute_normalized_hash(content: str) -> str:
|
|
35
|
-
"""Compute hash of normalized content.
|
|
36
|
-
|
|
37
|
-
Args:
|
|
38
|
-
content: Content to hash
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
str: SHA256 hash of the normalized content
|
|
42
|
-
"""
|
|
43
|
-
try:
|
|
44
|
-
# Try to parse as JSON to handle formatting
|
|
45
|
-
json_content = json.loads(content)
|
|
46
|
-
normalized = json.dumps(json_content, indent=2)
|
|
47
|
-
except json.JSONDecodeError:
|
|
48
|
-
# Not JSON, normalize line endings
|
|
49
|
-
normalized = content.replace("\r\n", "\n").replace("\r", "\n")
|
|
50
|
-
|
|
51
|
-
return hashlib.sha256(normalized.encode("utf-8")).hexdigest()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def collect_files_from_folder(
|
|
55
|
-
folder: ProjectFolder, base_path: str, files_dict: Dict[str, ProjectFile]
|
|
56
|
-
) -> None:
|
|
57
|
-
"""Recursively collect all files from a folder and its subfolders.
|
|
58
|
-
|
|
59
|
-
Args:
|
|
60
|
-
folder: The folder to collect files from
|
|
61
|
-
base_path: Base path for file paths
|
|
62
|
-
files_dict: Dictionary to store collected files
|
|
63
|
-
"""
|
|
64
|
-
# Add files from current folder
|
|
65
|
-
for file in folder.files:
|
|
66
|
-
file_path = os.path.join(base_path, file.name)
|
|
67
|
-
files_dict[file_path] = file
|
|
68
|
-
|
|
69
|
-
# Recursively process subfolders
|
|
70
|
-
for subfolder in folder.folders:
|
|
71
|
-
subfolder_path = os.path.join(base_path, subfolder.name)
|
|
72
|
-
collect_files_from_folder(subfolder, subfolder_path, files_dict)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
async def download_folder_files(
|
|
76
|
-
studio_client: StudioClient,
|
|
77
|
-
folder: ProjectFolder,
|
|
78
|
-
base_path: str,
|
|
79
|
-
processed_files: Set[str],
|
|
80
|
-
) -> None:
|
|
81
|
-
"""Download files from a folder recursively.
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
studio_client: Studio client
|
|
85
|
-
folder: The folder to download files from
|
|
86
|
-
base_path: Base path for local file storage
|
|
87
|
-
processed_files: Set to track processed files
|
|
88
|
-
"""
|
|
89
|
-
files_dict: Dict[str, ProjectFile] = {}
|
|
90
|
-
collect_files_from_folder(folder, "", files_dict)
|
|
91
|
-
|
|
92
|
-
for file_path, remote_file in files_dict.items():
|
|
93
|
-
local_path = os.path.join(base_path, file_path)
|
|
94
|
-
local_dir = os.path.dirname(local_path)
|
|
95
|
-
|
|
96
|
-
# Create directory if it doesn't exist
|
|
97
|
-
if not os.path.exists(local_dir):
|
|
98
|
-
os.makedirs(local_dir)
|
|
99
|
-
|
|
100
|
-
# Download remote file
|
|
101
|
-
response = await studio_client.download_file_async(remote_file.id)
|
|
102
|
-
remote_content = response.read().decode("utf-8")
|
|
103
|
-
remote_hash = compute_normalized_hash(remote_content)
|
|
104
|
-
|
|
105
|
-
if os.path.exists(local_path):
|
|
106
|
-
# Read and hash local file
|
|
107
|
-
with open(local_path, "r", encoding="utf-8") as f:
|
|
108
|
-
local_content = f.read()
|
|
109
|
-
local_hash = compute_normalized_hash(local_content)
|
|
110
|
-
|
|
111
|
-
# Compare hashes
|
|
112
|
-
if local_hash != remote_hash:
|
|
113
|
-
styled_path = click.style(str(file_path), fg="cyan")
|
|
114
|
-
console.warning(f"File {styled_path}" + " differs from remote version.")
|
|
115
|
-
response = click.prompt("Do you want to overwrite it? (y/n)", type=str)
|
|
116
|
-
if response.lower() == "y":
|
|
117
|
-
with open(local_path, "w", encoding="utf-8", newline="\n") as f:
|
|
118
|
-
f.write(remote_content)
|
|
119
|
-
console.success(f"Updated {click.style(str(file_path), fg='cyan')}")
|
|
120
|
-
else:
|
|
121
|
-
console.info(f"Skipped {click.style(str(file_path), fg='cyan')}")
|
|
122
|
-
else:
|
|
123
|
-
console.info(
|
|
124
|
-
f"File {click.style(str(file_path), fg='cyan')} is up to date"
|
|
125
|
-
)
|
|
126
|
-
else:
|
|
127
|
-
# File doesn't exist locally, create it
|
|
128
|
-
with open(local_path, "w", encoding="utf-8", newline="\n") as f:
|
|
129
|
-
f.write(remote_content)
|
|
130
|
-
console.success(f"Downloaded {click.style(str(file_path), fg='cyan')}")
|
|
131
|
-
|
|
132
|
-
processed_files.add(file_path)
|
|
133
|
-
|
|
134
|
-
|
|
135
27
|
@click.command()
|
|
136
28
|
@click.argument(
|
|
137
|
-
"root",
|
|
29
|
+
"root",
|
|
30
|
+
type=click.Path(exists=False, file_okay=False, dir_okay=True, path_type=Path),
|
|
31
|
+
default=Path("."),
|
|
138
32
|
)
|
|
139
33
|
@track
|
|
140
|
-
def pull(root:
|
|
34
|
+
def pull(root: Path) -> None:
|
|
141
35
|
"""Pull remote project files from Studio Web Project.
|
|
142
36
|
|
|
143
37
|
This command pulls the remote project files from a UiPath Studio Web project.
|
|
@@ -158,42 +52,8 @@ def pull(root: str) -> None:
|
|
|
158
52
|
if not (project_id := os.getenv(UIPATH_PROJECT_ID, False)):
|
|
159
53
|
console.error("UIPATH_PROJECT_ID environment variable not found.")
|
|
160
54
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
processed_files: Set[str] = set()
|
|
168
|
-
|
|
169
|
-
# Process source_code folder
|
|
170
|
-
source_code_folder = get_folder_by_name(structure, "source_code")
|
|
171
|
-
if source_code_folder:
|
|
172
|
-
asyncio.run(
|
|
173
|
-
download_folder_files(
|
|
174
|
-
studio_client,
|
|
175
|
-
source_code_folder,
|
|
176
|
-
root,
|
|
177
|
-
processed_files,
|
|
178
|
-
)
|
|
179
|
-
)
|
|
180
|
-
else:
|
|
181
|
-
console.warning("No source_code folder found in remote project")
|
|
182
|
-
|
|
183
|
-
# Process evals folder
|
|
184
|
-
evals_folder = get_folder_by_name(structure, "evals")
|
|
185
|
-
if evals_folder:
|
|
186
|
-
evals_path = os.path.join(root, "evals")
|
|
187
|
-
asyncio.run(
|
|
188
|
-
download_folder_files(
|
|
189
|
-
studio_client,
|
|
190
|
-
evals_folder,
|
|
191
|
-
evals_path,
|
|
192
|
-
processed_files,
|
|
193
|
-
)
|
|
194
|
-
)
|
|
195
|
-
else:
|
|
196
|
-
console.warning("No evals folder found in remote project")
|
|
197
|
-
|
|
198
|
-
except Exception as e:
|
|
199
|
-
console.error(f"Failed to pull UiPath project: {str(e)}")
|
|
55
|
+
default_download_configuration = {
|
|
56
|
+
"source_code": root,
|
|
57
|
+
"evals": root / "evals",
|
|
58
|
+
}
|
|
59
|
+
asyncio.run(pull_project(project_id, default_download_configuration))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.86
|
|
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
|
|
@@ -15,7 +15,7 @@ uipath/_cli/cli_invoke.py,sha256=m-te-EjhDpk_fhFDkt-yQFzmjEHGo5lQDGEQWxSXisQ,439
|
|
|
15
15
|
uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
|
|
16
16
|
uipath/_cli/cli_pack.py,sha256=NmwZTfwZ2fURiHyiX1BM0juAtBOjPB1Jmcpu-rD7p-4,11025
|
|
17
17
|
uipath/_cli/cli_publish.py,sha256=DgyfcZjvfV05Ldy0Pk5y_Le_nT9JduEE_x-VpIc_Kq0,6471
|
|
18
|
-
uipath/_cli/cli_pull.py,sha256=
|
|
18
|
+
uipath/_cli/cli_pull.py,sha256=pLUzS4wrSsTzO69wvJa6C-l9qTomySc15GOwliPPyHU,1785
|
|
19
19
|
uipath/_cli/cli_push.py,sha256=-j-gDIbT8GyU2SybLQqFl5L8KI9nu3CDijVtltDgX20,3132
|
|
20
20
|
uipath/_cli/cli_run.py,sha256=1FKv20EjxrrP1I5rNSnL_HzbWtOAIMjB3M--4RPA_Yo,3709
|
|
21
21
|
uipath/_cli/middlewares.py,sha256=0D9a-wphyetnH9T97F08o7-1OKWF1lMweFHHAR0xiOw,4979
|
|
@@ -82,7 +82,7 @@ uipath/_cli/_utils/_folders.py,sha256=RsYrXzF0NA1sPxgBoLkLlUY3jDNLg1V-Y8j71Q8a8H
|
|
|
82
82
|
uipath/_cli/_utils/_input_args.py,sha256=3LGNqVpJItvof75VGm-ZNTUMUH9-c7-YgleM5b2YgRg,5088
|
|
83
83
|
uipath/_cli/_utils/_parse_ast.py,sha256=8Iohz58s6bYQ7rgWtOTjrEInLJ-ETikmOMZzZdIY2Co,20072
|
|
84
84
|
uipath/_cli/_utils/_processes.py,sha256=q7DfEKHISDWf3pngci5za_z0Pbnf_shWiYEcTOTCiyk,1855
|
|
85
|
-
uipath/_cli/_utils/_project_files.py,sha256=
|
|
85
|
+
uipath/_cli/_utils/_project_files.py,sha256=1DQ0dY1oUyCP_y7i1PbqJv_JcDQmHzzsJy1bKcr3xYk,19671
|
|
86
86
|
uipath/_cli/_utils/_studio_project.py,sha256=8WYwi_CiTPRqo8KV2bsvj0H_KBFxTEN0Q2cXoZb-NnM,17030
|
|
87
87
|
uipath/_cli/_utils/_tracing.py,sha256=2igb03j3EHjF_A406UhtCKkPfudVfFPjUq5tXUEG4oo,1541
|
|
88
88
|
uipath/_cli/_utils/_uv_helpers.py,sha256=6SvoLnZPoKIxW0sjMvD1-ENV_HOXDYzH34GjBqwT138,3450
|
|
@@ -173,8 +173,8 @@ uipath/tracing/_utils.py,sha256=X-LFsyIxDeNOGuHPvkb6T5o9Y8ElYhr_rP3CEBJSu4s,1383
|
|
|
173
173
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
|
174
174
|
uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
|
|
175
175
|
uipath/utils/dynamic_schema.py,sha256=w0u_54MoeIAB-mf3GmwX1A_X8_HDrRy6p998PvX9evY,3839
|
|
176
|
-
uipath-2.1.
|
|
177
|
-
uipath-2.1.
|
|
178
|
-
uipath-2.1.
|
|
179
|
-
uipath-2.1.
|
|
180
|
-
uipath-2.1.
|
|
176
|
+
uipath-2.1.86.dist-info/METADATA,sha256=G_FdE5vnRC3-2kjfKVvUdE_W8-SiIDzcsNSj2bTowXs,6593
|
|
177
|
+
uipath-2.1.86.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
178
|
+
uipath-2.1.86.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
|
179
|
+
uipath-2.1.86.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
|
180
|
+
uipath-2.1.86.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|