uipath 2.0.33__py3-none-any.whl → 2.0.34__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/cli_new.py CHANGED
@@ -68,9 +68,8 @@ def new(name: str):
68
68
  ctx = click.get_current_context()
69
69
  init_cmd = ctx.parent.command.get_command(ctx, "init")
70
70
  ctx.invoke(init_cmd)
71
- console.hint(
72
- """Run project: uipath run main.py '{"message": "Hello World!"}'"""
73
- )
71
+ run_command = """uipath run main.py '{"message": "Hello World!"}'"""
72
+ console.hint(f"""Run project: {click.style(run_command, fg="cyan")}""")
74
73
 
75
74
 
76
75
  if __name__ == "__main__":
uipath/_cli/cli_run.py CHANGED
@@ -1,6 +1,5 @@
1
1
  # type: ignore
2
2
  import asyncio
3
- import logging
4
3
  import os
5
4
  import traceback
6
5
  from os import environ as env
@@ -16,9 +15,10 @@ from ._runtime._contracts import (
16
15
  UiPathTraceContext,
17
16
  )
18
17
  from ._runtime._runtime import UiPathRuntime
18
+ from ._utils._console import ConsoleLogger
19
19
  from .middlewares import MiddlewareResult, Middlewares
20
20
 
21
- logger = logging.getLogger(__name__)
21
+ console = ConsoleLogger()
22
22
  load_dotenv()
23
23
 
24
24
 
@@ -39,14 +39,14 @@ def python_run_middleware(
39
39
  return MiddlewareResult(
40
40
  should_continue=False,
41
41
  info_message="""Error: No entrypoint specified. Please provide a path to a Python script.
42
- Usage: `uipath run <entrypoint_path> <input_arguments>`""",
42
+ Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path>]`""",
43
43
  )
44
44
 
45
45
  if not os.path.exists(entrypoint):
46
46
  return MiddlewareResult(
47
47
  should_continue=False,
48
48
  error_message=f"""Error: Script not found at path {entrypoint}.
49
- Usage: `uipath run <entrypoint_path> <input_arguments>`""",
49
+ Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path>]`""",
50
50
  )
51
51
 
52
52
  try:
@@ -74,7 +74,6 @@ Usage: `uipath run <entrypoint_path> <input_arguments>`""",
74
74
  reference_id=env.get("UIPATH_JOB_KEY") or str(uuid4()),
75
75
  )
76
76
  context.logs_min_level = env.get("LOG_LEVEL", "INFO")
77
-
78
77
  async with UiPathRuntime.from_context(context) as runtime:
79
78
  await runtime.execute()
80
79
 
@@ -91,7 +90,6 @@ Usage: `uipath run <entrypoint_path> <input_arguments>`""",
91
90
  )
92
91
  except Exception as e:
93
92
  # Handle unexpected errors
94
- logger.exception("Unexpected error in Python runtime middleware")
95
93
  return MiddlewareResult(
96
94
  should_continue=False,
97
95
  error_message=f"Error: Unexpected error occurred - {str(e)}",
@@ -103,8 +101,23 @@ Usage: `uipath run <entrypoint_path> <input_arguments>`""",
103
101
  @click.argument("entrypoint", required=False)
104
102
  @click.argument("input", required=False, default="{}")
105
103
  @click.option("--resume", is_flag=True, help="Resume execution from a previous state")
106
- def run(entrypoint: Optional[str], input: Optional[str], resume: bool) -> None:
104
+ @click.option(
105
+ "-f",
106
+ "--file",
107
+ required=False,
108
+ type=click.Path(exists=True),
109
+ help="File path for the .json input",
110
+ )
111
+ def run(
112
+ entrypoint: Optional[str], input: Optional[str], resume: bool, file: Optional[str]
113
+ ) -> None:
107
114
  """Execute the project."""
115
+ if file:
116
+ _, file_extension = os.path.splitext(file)
117
+ if file_extension != ".json":
118
+ console.error("Input file extension must be '.json'.")
119
+ with open(file) as f:
120
+ input = f.read()
108
121
  # Process through middleware chain
109
122
  result = Middlewares.next("run", entrypoint, input, resume)
110
123
 
@@ -115,18 +128,22 @@ def run(entrypoint: Optional[str], input: Optional[str], resume: bool) -> None:
115
128
 
116
129
  # Handle result from middleware
117
130
  if result.error_message:
118
- click.echo(result.error_message, err=True)
131
+ console.error(result.error_message, include_traceback=True)
119
132
  if result.should_include_stacktrace:
120
- click.echo(traceback.format_exc(), err=True)
133
+ console.error(traceback.format_exc())
121
134
  click.get_current_context().exit(1)
122
135
 
123
136
  if result.info_message:
124
- click.echo(result.info_message)
137
+ console.info(result.info_message)
125
138
 
126
139
  # If middleware chain completed but didn't handle the request
127
140
  if result.should_continue:
128
- click.echo("Error: Could not process the request with any available handler.")
129
- click.get_current_context().exit(1)
141
+ console.error(
142
+ "Error: Could not process the request with any available handler."
143
+ )
144
+
145
+ if not result.should_continue and not result.error_message:
146
+ console.success("Successful execution.")
130
147
 
131
148
 
132
149
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.33
3
+ Version: 2.0.34
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
@@ -10,10 +10,10 @@ uipath/_cli/cli_auth.py,sha256=O-hbaYxLXBPXgnjW2gGa1lbvmVh1ui2-U9BzrLUU708,3707
10
10
  uipath/_cli/cli_deploy.py,sha256=lnGwwhDDY6La0fj_-duqx9saGUvY2iNNW28rQCI3hsU,308
11
11
  uipath/_cli/cli_init.py,sha256=Hk4R7dxTkRkSdo4gbp6QSKXe2jVdR5PBSDVjxCt7TO0,3834
12
12
  uipath/_cli/cli_invoke.py,sha256=Fnoc5_4nWxac-FVxQL-Akrqd-yQb9BwLWSzR9p397Lw,3221
13
- uipath/_cli/cli_new.py,sha256=uBWt44ZnNrq6oMYjYm4cCipmat2GRkcJ-g8YP_yP9-0,2024
13
+ uipath/_cli/cli_new.py,sha256=dZGdyPDk16L17JdmDh_cY6MNSvf0CwNrrAQmzUo-eUw,2069
14
14
  uipath/_cli/cli_pack.py,sha256=FZr7P5WZvPkrP56fjn4dTONv76NuoEhVtQwzG3CxGQs,14667
15
15
  uipath/_cli/cli_publish.py,sha256=qhuYQq8kogUbCDd-x7_vV4Px8t-0UeAjm96lE7KQBHM,5679
16
- uipath/_cli/cli_run.py,sha256=BSVx4fLJnBgpqK1VoRbSvpA_o4N0IbxQCU3fNmyry8I,4577
16
+ uipath/_cli/cli_run.py,sha256=ke4UQiqzagv4ST60-mvcC7nh1dQMw_Z6GQ2hAbnspU0,5074
17
17
  uipath/_cli/middlewares.py,sha256=IiJgjsqrJVKSXx4RcIKHWoH-SqWqpHPbhzkQEybmAos,3937
18
18
  uipath/_cli/spinner.py,sha256=bS-U_HA5yne11ejUERu7CQoXmWdabUD2bm62EfEdV8M,1107
19
19
  uipath/_cli/_auth/_auth_server.py,sha256=GRdjXUcvZO2O2GecolFJ8uMv7_DUD_VXeBJpElqmtIQ,7034
@@ -79,8 +79,8 @@ uipath/tracing/__init__.py,sha256=GimSzv6qkCOlHOG1WtjYKJsZqcXpA28IgoXfR33JhiA,13
79
79
  uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
80
80
  uipath/tracing/_traced.py,sha256=GFxOp73jk0vGTN_H7YZOOsEl9rVLaEhXGztMiYKIA-8,16634
81
81
  uipath/tracing/_utils.py,sha256=5SwsTGpHkIouXBndw-u8eCLnN4p7LM8DsTCCuf2jJgs,10165
82
- uipath-2.0.33.dist-info/METADATA,sha256=a-Naq5cfMirA_LJr5Ew3f7G8LNaWNz3KEdRqziZBAi4,6303
83
- uipath-2.0.33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- uipath-2.0.33.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
85
- uipath-2.0.33.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
86
- uipath-2.0.33.dist-info/RECORD,,
82
+ uipath-2.0.34.dist-info/METADATA,sha256=bdFotTo0CoY9SN7LM9cx328-GFo2MNlrRz5vPx-MTjg,6303
83
+ uipath-2.0.34.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ uipath-2.0.34.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
85
+ uipath-2.0.34.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
86
+ uipath-2.0.34.dist-info/RECORD,,