From 01eebd1abc16f7df1c5e8240ab9ad2dc89c71c77 Mon Sep 17 00:00:00 2001 From: Robert Ursu Date: Thu, 26 Nov 2026 11:27:14 +0200 Subject: [PATCH] chore(uipath): require uipath-runtime 0.13.7 uipath-runtime 0.13.7 adds the stop probe, so the execution loop now always installs it and a job the server stops always ends as stopped. The fallback for runtimes without the probe is gone, and the tests use the real probe instead of a fake module. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fmj9j6BHFgyskAHtyrUX7i --- packages/uipath/pyproject.toml | 4 +- .../src/uipath/_cli/_execution_control.py | 9 ++-- .../tests/cli/test_execution_control.py | 45 ++++--------------- packages/uipath/uv.lock | 12 ++--- 4 files changed, 19 insertions(+), 51 deletions(-) diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index 0a6d27d87..86211e9a3 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,12 +1,12 @@ [project] name = "uipath" -version = "2.15.12" +version = "2.15.13" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" dependencies = [ "uipath-core>=0.5.35, <0.6.0", - "uipath-runtime>=0.13.5, <0.14.0", + "uipath-runtime>=0.13.7, <0.14.0", "uipath-platform>=0.3.15, <0.4.0", "uipath-ipc>=2.5.1, <2.6.0", "click>=8.3.3, <9.0.0", diff --git a/packages/uipath/src/uipath/_cli/_execution_control.py b/packages/uipath/src/uipath/_cli/_execution_control.py index 028acc4a3..216183a14 100644 --- a/packages/uipath/src/uipath/_cli/_execution_control.py +++ b/packages/uipath/src/uipath/_cli/_execution_control.py @@ -10,7 +10,6 @@ import asyncio import concurrent.futures import contextvars -import importlib import threading from typing import Any @@ -120,8 +119,6 @@ def run_execution_loop(coro: Any) -> Any: def _report_stops_as_stopped(control: ExecutionControl) -> None: """Let the runtime tell a cancellation this control delivered from a failure.""" - try: - stop = importlib.import_module("uipath.runtime.stop") - except ImportError: # uipath-runtime before 0.13.6 reports a stop as a fault - return - stop.set_stop_requested_probe(lambda: control.delivered) + from uipath.runtime.stop import set_stop_requested_probe + + set_stop_requested_probe(lambda: control.delivered) diff --git a/packages/uipath/tests/cli/test_execution_control.py b/packages/uipath/tests/cli/test_execution_control.py index 411e33693..289df4183 100644 --- a/packages/uipath/tests/cli/test_execution_control.py +++ b/packages/uipath/tests/cli/test_execution_control.py @@ -1,18 +1,14 @@ """What an execution's loop tells the runtime about the stops it delivers.""" import asyncio -import contextvars -import sys -import types from typing import Any -import pytest - from uipath._cli._execution_control import ( CURRENT_EXECUTION_CONTROL, ExecutionControl, run_execution_loop, ) +from uipath.runtime.stop import get_stop_requested_probe def _run_controlled(control: ExecutionControl, coro: Any) -> Any: @@ -23,22 +19,12 @@ def _run_controlled(control: ExecutionControl, coro: Any) -> Any: CURRENT_EXECUTION_CONTROL.reset(token) -@pytest.fixture -def stop_module(monkeypatch: pytest.MonkeyPatch) -> contextvars.ContextVar[Any]: - probe: contextvars.ContextVar[Any] = contextvars.ContextVar("probe", default=None) - module = types.ModuleType("uipath.runtime.stop") - module.set_stop_requested_probe = probe.set # type: ignore[attr-defined] - monkeypatch.setitem(sys.modules, "uipath.runtime.stop", module) - return probe - - -def test_the_runtime_learns_a_stop_reached_the_execution( - stop_module: contextvars.ContextVar[Any], -) -> None: +def test_the_runtime_learns_a_stop_reached_the_execution() -> None: control = ExecutionControl() async def body() -> tuple[bool, bool]: - probe = stop_module.get() + probe = get_stop_requested_probe() + assert probe is not None before = probe() control.cancel() try: @@ -66,32 +52,17 @@ def test_a_stop_that_reaches_a_finished_execution_is_not_delivered() -> None: assert control.delivered is False -def test_the_probe_stays_inside_the_execution( - stop_module: contextvars.ContextVar[Any], -) -> None: +def test_the_probe_stays_inside_the_execution() -> None: async def body() -> None: return None _run_controlled(ExecutionControl(), body()) - assert stop_module.get() is None + assert get_stop_requested_probe() is None -def test_an_uncontrolled_run_installs_no_probe( - stop_module: contextvars.ContextVar[Any], -) -> None: +def test_an_uncontrolled_run_installs_no_probe() -> None: async def body() -> Any: - return stop_module.get() + return get_stop_requested_probe() assert run_execution_loop(body()) is None - - -def test_a_runtime_without_the_probe_still_runs( - monkeypatch: pytest.MonkeyPatch, -) -> None: - monkeypatch.setitem(sys.modules, "uipath.runtime.stop", None) - - async def body() -> str: - return "ran" - - assert _run_controlled(ExecutionControl(), body()) == "ran" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index da98e5923..4e96163d8 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -3,7 +3,7 @@ revision = 3 requires-python = ">=3.11" [options] -exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values. +exclude-newer = "2026-11-24T09:19:03.0927496Z" exclude-newer-span = "P2D" [options.exclude-newer-package] @@ -2720,7 +2720,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.15.12" +version = "2.15.13" source = { editable = "." } dependencies = [ { name = "applicationinsights" }, @@ -2805,7 +2805,7 @@ requires-dist = [ { name = "uipath-ipc", specifier = ">=2.5.1,<2.6.0" }, { name = "uipath-ipc", marker = "extra == 'ipc'", specifier = ">=2.5.1,<2.6.0" }, { name = "uipath-platform", editable = "../uipath-platform" }, - { name = "uipath-runtime", specifier = ">=0.13.5,<0.14.0" }, + { name = "uipath-runtime", specifier = ">=0.13.7,<0.14.0" }, ] provides-extras = ["ipc"] @@ -2926,16 +2926,16 @@ dev = [ [[package]] name = "uipath-runtime" -version = "0.13.5" +version = "0.13.7" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "chardet" }, { name = "uipath-core" }, { name = "vadersentiment" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c8/8f/14ff9ccf152b6d97c0881f6b40d3e01037045ee52c467ed00dbb2319a0cb/uipath_runtime-0.13.5.tar.gz", hash = "sha256:923e4514f3d868f3711211fee6e2dd39f76c6aaf7354fec9e80cdc5e6fad5d80", size = 250415, upload-time = "2026-09-10T09:32:53.126Z" } +sdist = { url = "https://files.pythonhosted.org/packages/15/df/1d4134ed12459b3ad78626901044a191e377050a98de2535a21d591a571b/uipath_runtime-0.13.7.tar.gz", hash = "sha256:d7a65f72dcb5cede4f9d6fce9a639be8ce8cbfb1785046b6c9518b7a4179e46c", size = 256483, upload-time = "2026-11-26T09:18:16.87Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/95/88/b851e75b3c70bbedde1e24d5b5f38035863ed3d50e8facb75ac7d2db40b8/uipath_runtime-0.13.5-py3-none-any.whl", hash = "sha256:d5eb7d578689f67d5dd631d28a092954c9a8797e130e16fe46e2895e4b0656ac", size = 98513, upload-time = "2026-09-10T09:32:51.404Z" }, + { url = "https://files.pythonhosted.org/packages/fe/db/138573ca0f1b58084d5c82ac9a8280d37227f70d8e779454129ab676f67f/uipath_runtime-0.13.7-py3-none-any.whl", hash = "sha256:7ff61c6d1a879c970916307be6de983f341dbe45d44688cafa8685bdc4e8c6a5", size = 100415, upload-time = "2026-11-26T09:18:15.374Z" }, ] [[package]]