uipath 2.1.83__py3-none-any.whl → 2.1.84__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.

@@ -7,6 +7,7 @@ from typing import Any, Dict, Optional, Set
7
7
 
8
8
  import click
9
9
 
10
+ from ...models.exceptions import EnrichedException
10
11
  from .._utils._console import ConsoleLogger
11
12
  from .._utils._constants import (
12
13
  AGENT_INITIAL_CODE_VERSION,
@@ -483,7 +484,15 @@ class SwFileHandler:
483
484
  Raises:
484
485
  Exception: If any step in the process fails
485
486
  """
486
- structure = await self._studio_client.get_project_structure_async()
487
+ try:
488
+ structure = await self._studio_client.get_project_structure_async()
489
+ except EnrichedException as e:
490
+ if e.status_code == 404:
491
+ structure = ProjectStructure(name="", files=[], folders=[])
492
+ await self._studio_client._put_lock()
493
+ else:
494
+ raise
495
+
487
496
  source_code_folder = self._get_folder_by_name(structure, "source_code")
488
497
  root_files, source_code_files = self._get_remote_files(
489
498
  structure, source_code_folder
@@ -224,6 +224,45 @@ def with_lock_retry(func: Callable[..., Any]) -> Callable[..., Any]:
224
224
  return wrapper
225
225
 
226
226
 
227
+ class StudioSolutionsClient:
228
+ def __init__(self, solution_id: str):
229
+ from uipath import UiPath
230
+
231
+ self.uipath: UiPath = UiPath()
232
+ self._solutions_base_url: str = f"/studio_/backend/api/Solution/{solution_id}"
233
+
234
+ async def create_project_async(
235
+ self,
236
+ project_name: str,
237
+ project_type: str = "Agent",
238
+ trigger_type: str = "Manual",
239
+ ):
240
+ """Create a new project in the specified solution.
241
+
242
+ Args:
243
+ project_name: The name for the new project
244
+ project_type: The type of project to create (default: "Agent")
245
+ trigger_type: The trigger type for the project (default: "Manual")
246
+
247
+ Returns:
248
+ dict: The created project details including project ID
249
+ """
250
+ data = {
251
+ "createDefaultProjectCommand[projectType]": project_type,
252
+ "createDefaultProjectCommand[triggerType]": trigger_type,
253
+ "createDefaultProjectCommand[name]": project_name,
254
+ }
255
+
256
+ response = await self.uipath.api_client.request_async(
257
+ "POST",
258
+ url=f"{self._solutions_base_url}/projects",
259
+ data=data,
260
+ scoped="org",
261
+ )
262
+
263
+ return response.json()
264
+
265
+
227
266
  class StudioClient:
228
267
  def __init__(self, project_id: str):
229
268
  from uipath import UiPath
@@ -464,3 +503,10 @@ class StudioClient:
464
503
  scoped="org",
465
504
  )
466
505
  return LockInfo.model_validate(response.json())
506
+
507
+ async def _put_lock(self):
508
+ await self.uipath.api_client.request_async(
509
+ "PUT",
510
+ url=f"{self._lock_operations_base_url}/dummy-uuid-Shared?api-version=2",
511
+ scoped="org",
512
+ )
uipath/agent/_utils.py CHANGED
@@ -5,10 +5,12 @@ from httpx import Response
5
5
  from pydantic import TypeAdapter
6
6
 
7
7
  from uipath._cli._evals._models._evaluation_set import LLMMockingStrategy
8
+ from uipath._cli._push.sw_file_handler import SwFileHandler
8
9
  from uipath._cli._utils._studio_project import (
9
10
  ProjectFile,
10
11
  ProjectFolder,
11
12
  StudioClient,
13
+ StudioSolutionsClient,
12
14
  resolve_path,
13
15
  )
14
16
  from uipath.agent.models.agent import (
@@ -27,6 +29,20 @@ async def get_file(
27
29
  return await studio_client.download_file_async(resolved.id)
28
30
 
29
31
 
32
+ async def create_agent_project(solution_id: str, project_name: str) -> str:
33
+ studio_client = StudioSolutionsClient(solution_id=solution_id)
34
+ project = await studio_client.create_project_async(project_name=project_name)
35
+ return project["id"]
36
+
37
+
38
+ async def upload_project_files(project_id: str, root: str) -> None:
39
+ sw_file_handler = SwFileHandler(
40
+ project_id=project_id,
41
+ directory=root,
42
+ )
43
+ await sw_file_handler.upload_source_files({})
44
+
45
+
30
46
  async def load_agent_definition(project_id: str) -> AgentDefinition:
31
47
  studio_client = StudioClient(project_id=project_id)
32
48
  project_structure = await studio_client.get_project_structure_async()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.1.83
3
+ Version: 2.1.84
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
@@ -61,7 +61,7 @@ uipath/_cli/_evals/mocks/mocker.py,sha256=p9UpJDIckvCgkO0qqJHWdMMSbySBOoa8xpEIi2
61
61
  uipath/_cli/_evals/mocks/mocker_factory.py,sha256=V5QKSTtQxztTo4-fK1TyAaXw2Z3mHf2UC5mXqwuUGTs,811
62
62
  uipath/_cli/_evals/mocks/mockito_mocker.py,sha256=AO2BmFwA6hz3Lte-STVr7aJDPvMCqKNKa4j2jeNZ_U4,2677
63
63
  uipath/_cli/_evals/mocks/mocks.py,sha256=jfenoCSnMPpaXEyAcRDVu5jIfb62eRredRenZDI_AzE,1965
64
- uipath/_cli/_push/sw_file_handler.py,sha256=iE8Sk1Z-9hxmLFFj3j-k4kTK6TzNFP6hUCmxTudG6JQ,18251
64
+ uipath/_cli/_push/sw_file_handler.py,sha256=ku__shuywCvQfL6_1c1nM-40q-rkQAJsP6-rOlzyTUw,18566
65
65
  uipath/_cli/_runtime/_contracts.py,sha256=E8Is7EQfAu7_hCbeZI68gmTxSxo4X7_U4vcSl7D3Syg,28988
66
66
  uipath/_cli/_runtime/_escalation.py,sha256=x3vI98qsfRA-fL_tNkRVTFXioM5Gv2w0GFcXJJ5eQtg,7981
67
67
  uipath/_cli/_runtime/_hitl.py,sha256=VKbM021nVg1HEDnTfucSLJ0LsDn83CKyUtVzofS2qTU,11369
@@ -83,7 +83,7 @@ uipath/_cli/_utils/_input_args.py,sha256=3LGNqVpJItvof75VGm-ZNTUMUH9-c7-YgleM5b2
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
85
  uipath/_cli/_utils/_project_files.py,sha256=62VwZrroeKjlnqMqYSy3Aex11n9qYb7J8n3a8IVdo3I,15156
86
- uipath/_cli/_utils/_studio_project.py,sha256=hmWn9i7COkms3wAy5Di04ENF9KZAwbn_lyyTGDyq9uU,15571
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
89
89
  uipath/_events/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -119,7 +119,7 @@ uipath/_utils/_ssl_context.py,sha256=xSYitos0eJc9cPHzNtHISX9PBvL6D2vas5G_GiBdLp8
119
119
  uipath/_utils/_url.py,sha256=-4eluSrIZCUlnQ3qU17WPJkgaC2KwF9W5NeqGnTNGGo,2512
120
120
  uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
121
121
  uipath/_utils/constants.py,sha256=2xLT-1aW0aJS2USeZbK-7zRgyyi1bgV60L0rtQOUqOM,1721
122
- uipath/agent/_utils.py,sha256=mf4CtOZch1SFR83Z4QIkjXqMKK8Pm_xV8Q0-RedDkcE,4443
122
+ uipath/agent/_utils.py,sha256=jd6AETgrGnY2elzqNLs1JVgcedoc9H046AREmznihk8,5000
123
123
  uipath/agent/conversation/__init__.py,sha256=5hK-Iz131mnd9m6ANnpZZffxXZLVFDQ9GTg5z9ik1oQ,5265
124
124
  uipath/agent/conversation/async_stream.py,sha256=BA_8uU1DgE3VpU2KkJj0rkI3bAHLk_ZJKsajR0ipMpo,2055
125
125
  uipath/agent/conversation/citation.py,sha256=42dGv-wiYx3Lt7MPuPCFTkjAlSADFSzjyNXuZHdxqvo,2253
@@ -172,8 +172,8 @@ uipath/tracing/_traced.py,sha256=yBIY05PCCrYyx50EIHZnwJaKNdHPNx-YTR1sHQl0a98,199
172
172
  uipath/tracing/_utils.py,sha256=X-LFsyIxDeNOGuHPvkb6T5o9Y8ElYhr_rP3CEBJSu4s,13837
173
173
  uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
174
174
  uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
175
- uipath-2.1.83.dist-info/METADATA,sha256=0FpqZ7BXOLEsQ0jPwICiBE27Xbx9S6LS6FJo7LdgMV8,6593
176
- uipath-2.1.83.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
177
- uipath-2.1.83.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
178
- uipath-2.1.83.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
179
- uipath-2.1.83.dist-info/RECORD,,
175
+ uipath-2.1.84.dist-info/METADATA,sha256=qoHn0sW3KLxB59TgARTElWJm91_930iMUEY-XLpgjaA,6593
176
+ uipath-2.1.84.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
177
+ uipath-2.1.84.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
178
+ uipath-2.1.84.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
179
+ uipath-2.1.84.dist-info/RECORD,,