uipath 2.1.69__py3-none-any.whl → 2.1.70__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.
- uipath/_cli/_dev/_terminal/__init__.py +15 -1
- uipath/_cli/_dev/_terminal/_utils/_logger.py +67 -1
- {uipath-2.1.69.dist-info → uipath-2.1.70.dist-info}/METADATA +1 -1
- {uipath-2.1.69.dist-info → uipath-2.1.70.dist-info}/RECORD +7 -7
- {uipath-2.1.69.dist-info → uipath-2.1.70.dist-info}/WHEEL +0 -0
- {uipath-2.1.69.dist-info → uipath-2.1.70.dist-info}/entry_points.txt +0 -0
- {uipath-2.1.69.dist-info → uipath-2.1.70.dist-info}/licenses/LICENSE +0 -0
@@ -37,7 +37,7 @@ from ._models._execution import ExecutionRun
|
|
37
37
|
from ._models._messages import LogMessage, TraceMessage
|
38
38
|
from ._utils._chat import RunContextChatHandler, build_user_message_event
|
39
39
|
from ._utils._exporter import RunContextExporter
|
40
|
-
from ._utils._logger import RunContextLogHandler
|
40
|
+
from ._utils._logger import RunContextLogHandler, patch_textual_stderr
|
41
41
|
|
42
42
|
|
43
43
|
class UiPathDevTerminal(App[Any]):
|
@@ -61,6 +61,8 @@ class UiPathDevTerminal(App[Any]):
|
|
61
61
|
runtime_factory: UiPathRuntimeFactory[Any, Any],
|
62
62
|
**kwargs,
|
63
63
|
):
|
64
|
+
self._stderr_write_fd: int = patch_textual_stderr(self._add_subprocess_log)
|
65
|
+
|
64
66
|
super().__init__(**kwargs)
|
65
67
|
|
66
68
|
self.initial_entrypoint: str = "main.py"
|
@@ -357,3 +359,15 @@ class UiPathDevTerminal(App[Any]):
|
|
357
359
|
)
|
358
360
|
log_msg = LogMessage(run.id, "ERROR", tb, timestamp)
|
359
361
|
self._handle_log_message(log_msg)
|
362
|
+
|
363
|
+
def _add_subprocess_log(self, level: str, message: str) -> None:
|
364
|
+
"""Handle a stderr line coming from subprocesses."""
|
365
|
+
|
366
|
+
def add_log() -> None:
|
367
|
+
details_panel = self.query_one("#details-panel", RunDetailsPanel)
|
368
|
+
run = getattr(details_panel, "current_run", None)
|
369
|
+
if run:
|
370
|
+
log_msg = LogMessage(run.id, level, message, datetime.now())
|
371
|
+
self._handle_log_message(log_msg)
|
372
|
+
|
373
|
+
self.call_from_thread(add_log)
|
@@ -1,6 +1,11 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
1
3
|
import logging
|
4
|
+
import os
|
5
|
+
import re
|
6
|
+
import threading
|
2
7
|
from datetime import datetime
|
3
|
-
from typing import Callable
|
8
|
+
from typing import Callable, Pattern
|
4
9
|
|
5
10
|
from .._models._messages import LogMessage
|
6
11
|
|
@@ -30,3 +35,64 @@ class RunContextLogHandler(logging.Handler):
|
|
30
35
|
except Exception:
|
31
36
|
# Don't let logging errors crash the app
|
32
37
|
pass
|
38
|
+
|
39
|
+
|
40
|
+
# A dispatcher is a callable that accepts (level, message) pairs
|
41
|
+
DispatchLog = Callable[[str, str], None]
|
42
|
+
|
43
|
+
LEVEL_PATTERNS: list[tuple[str, Pattern[str]]] = [
|
44
|
+
("DEBUG", re.compile(r"^(DEBUG)[:\s-]+", re.I)),
|
45
|
+
("INFO", re.compile(r"^(INFO)[:\s-]+", re.I)),
|
46
|
+
("WARN", re.compile(r"^(WARNING|WARN)[:\s-]+", re.I)),
|
47
|
+
("ERROR", re.compile(r"^(ERROR|ERRO)[:\s-]+", re.I)),
|
48
|
+
]
|
49
|
+
|
50
|
+
|
51
|
+
def patch_textual_stderr(dispatch_log: DispatchLog) -> int:
|
52
|
+
"""Redirect subprocess stderr into a provided dispatcher.
|
53
|
+
|
54
|
+
Args:
|
55
|
+
dispatch_log: Callable invoked with (level, message) for each stderr line.
|
56
|
+
This will be called from a background thread, so the caller
|
57
|
+
should use `App.call_from_thread` or equivalent.
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
int: The write file descriptor for stderr (pass to subprocesses).
|
61
|
+
"""
|
62
|
+
from textual.app import _PrintCapture
|
63
|
+
|
64
|
+
read_fd, write_fd = os.pipe()
|
65
|
+
|
66
|
+
# Patch fileno() so subprocesses can write to our pipe
|
67
|
+
_PrintCapture.fileno = lambda self: write_fd # type: ignore[method-assign]
|
68
|
+
|
69
|
+
def read_stderr_pipe() -> None:
|
70
|
+
with os.fdopen(read_fd, "r", buffering=1) as pipe_reader:
|
71
|
+
try:
|
72
|
+
for raw in pipe_reader:
|
73
|
+
text = raw.rstrip()
|
74
|
+
level: str = "ERROR"
|
75
|
+
message: str = text
|
76
|
+
|
77
|
+
# Try to parse a known level prefix
|
78
|
+
for lvl, pattern in LEVEL_PATTERNS:
|
79
|
+
m = pattern.match(text)
|
80
|
+
if m:
|
81
|
+
level = lvl
|
82
|
+
message = text[m.end() :]
|
83
|
+
break
|
84
|
+
|
85
|
+
dispatch_log(level, message)
|
86
|
+
|
87
|
+
except Exception:
|
88
|
+
# Never raise from thread
|
89
|
+
pass
|
90
|
+
|
91
|
+
thread = threading.Thread(
|
92
|
+
target=read_stderr_pipe,
|
93
|
+
daemon=True,
|
94
|
+
name="stderr-reader",
|
95
|
+
)
|
96
|
+
thread.start()
|
97
|
+
|
98
|
+
return write_fd
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: uipath
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.70
|
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
|
@@ -32,7 +32,7 @@ uipath/_cli/_auth/auth_config.json,sha256=o8J5BBFwiEtjZLHpJ_64lvnTeYeRIHaJ-Bhg0Q
|
|
32
32
|
uipath/_cli/_auth/index.html,sha256=uGK0CDTP8Rys_p4O_Pbd2x4tz0frKNVcumjrXnal5Nc,22814
|
33
33
|
uipath/_cli/_auth/localhost.crt,sha256=oGl9oLLOiouHubAt39B4zEfylFvKEtbtr_43SIliXJc,1226
|
34
34
|
uipath/_cli/_auth/localhost.key,sha256=X31VYXD8scZtmGA837dGX5l6G-LXHLo5ItWJhZXaz3c,1679
|
35
|
-
uipath/_cli/_dev/_terminal/__init__.py,sha256=
|
35
|
+
uipath/_cli/_dev/_terminal/__init__.py,sha256=di_RiN9Mcp9wqyKRRqXag28vbSw8_78mCnQZNn9H-Ss,14027
|
36
36
|
uipath/_cli/_dev/_terminal/_components/_chat.py,sha256=NLRoy49QScHiI-q0FGykkaU8ajv1d23fx7issSALcFA,4119
|
37
37
|
uipath/_cli/_dev/_terminal/_components/_details.py,sha256=FbLYtJ56gqHV6CIrpzO_n9Sk_YNg4nzRKTSsbj-DBPQ,17257
|
38
38
|
uipath/_cli/_dev/_terminal/_components/_history.py,sha256=dcT9tohEwpUaLGi7VWu5d-mDIF45UxFzN2Yvdf5N-eM,2691
|
@@ -43,7 +43,7 @@ uipath/_cli/_dev/_terminal/_models/_messages.py,sha256=p66MHUi_SS30CQWXtiwydybMK
|
|
43
43
|
uipath/_cli/_dev/_terminal/_styles/terminal.tcss,sha256=ktVpKwXIXw2VZp8KIZD6fO9i9NTGvts_icCTxMdzEiY,3240
|
44
44
|
uipath/_cli/_dev/_terminal/_utils/_chat.py,sha256=YUZxYVdmEManwHDuZsczJT1dWIYE1dVBgABlurwMFcE,8493
|
45
45
|
uipath/_cli/_dev/_terminal/_utils/_exporter.py,sha256=oI6D_eMwrh_2aqDYUh4GrJg8VLGrLYhDahR-_o0uJns,4144
|
46
|
-
uipath/_cli/_dev/_terminal/_utils/_logger.py,sha256=
|
46
|
+
uipath/_cli/_dev/_terminal/_utils/_logger.py,sha256=_ipTl_oAiMF9I7keGt2AAFAMz40DNLVMVkoiq-07UAU,2943
|
47
47
|
uipath/_cli/_evals/_evaluator_factory.py,sha256=OWfLxPOEcDn4qv5m3n7LBfIBKcdTPml2ZCLcsqSymlU,5329
|
48
48
|
uipath/_cli/_evals/_progress_reporter.py,sha256=hpSt0CXpIoFJGsbqZkqmwyGO_TBNesbWKlvDJUEDxd8,16455
|
49
49
|
uipath/_cli/_evals/_runtime.py,sha256=WKcBT6DGzNRjgEOpmH0b7RoEbEsHMyAbcAMs8b_CAI0,11418
|
@@ -158,8 +158,8 @@ uipath/tracing/_traced.py,sha256=yBIY05PCCrYyx50EIHZnwJaKNdHPNx-YTR1sHQl0a98,199
|
|
158
158
|
uipath/tracing/_utils.py,sha256=qd7N56tg6VXQ9pREh61esBgUWLNA0ssKsE0QlwrRWFM,11974
|
159
159
|
uipath/utils/__init__.py,sha256=VD-KXFpF_oWexFg6zyiWMkxl2HM4hYJMIUDZ1UEtGx0,105
|
160
160
|
uipath/utils/_endpoints_manager.py,sha256=iRTl5Q0XAm_YgcnMcJOXtj-8052sr6jpWuPNz6CgT0Q,8408
|
161
|
-
uipath-2.1.
|
162
|
-
uipath-2.1.
|
163
|
-
uipath-2.1.
|
164
|
-
uipath-2.1.
|
165
|
-
uipath-2.1.
|
161
|
+
uipath-2.1.70.dist-info/METADATA,sha256=Psv1JkySYItSXLqXbmXX2QBnKgVHtESV3-dEiKtCVEc,6482
|
162
|
+
uipath-2.1.70.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
163
|
+
uipath-2.1.70.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
|
164
|
+
uipath-2.1.70.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
|
165
|
+
uipath-2.1.70.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|