From 3cd5a435cd3c8ec450c4d28272d049dfd7b188e3 Mon Sep 17 00:00:00 2001 From: Cristian Pufu Date: Mon, 10 Nov 2025 14:52:11 +0200 Subject: [PATCH] fix: proper folder structure --- src/uipath/dev/__init__.py | 19 +++++++++---------- src/uipath/dev/infrastructure/__init__.py | 13 +++++++++++++ .../logging_handlers.py} | 3 +++ .../tracing_exporter.py} | 3 +++ src/uipath/dev/models/__init__.py | 10 ++++++++++ src/uipath/dev/ui/panels/__init__.py | 11 +++++++++++ .../new.py => ui/panels/new_run_panel.py} | 2 +- .../panels/run_details_panel.py} | 0 .../panels/run_history_panel.py} | 0 .../dev/{_styles => ui/styles}/terminal.tcss | 0 .../{components => ui/widgets}/json_input.py | 0 11 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 src/uipath/dev/infrastructure/__init__.py rename src/uipath/dev/{_utils/_logger.py => infrastructure/logging_handlers.py} (96%) rename src/uipath/dev/{_utils/_exporter.py => infrastructure/tracing_exporter.py} (96%) create mode 100644 src/uipath/dev/models/__init__.py create mode 100644 src/uipath/dev/ui/panels/__init__.py rename src/uipath/dev/{components/new.py => ui/panels/new_run_panel.py} (98%) rename src/uipath/dev/{components/details.py => ui/panels/run_details_panel.py} (100%) rename src/uipath/dev/{components/history.py => ui/panels/run_history_panel.py} (100%) rename src/uipath/dev/{_styles => ui/styles}/terminal.tcss (100%) rename src/uipath/dev/{components => ui/widgets}/json_input.py (100%) diff --git a/src/uipath/dev/__init__.py b/src/uipath/dev/__init__.py index 04b8bbe..dd7bf5d 100644 --- a/src/uipath/dev/__init__.py +++ b/src/uipath/dev/__init__.py @@ -1,4 +1,4 @@ -"""UiPath Dev Terminal Application.""" +"""UiPath Developer Console Application.""" import asyncio import json @@ -24,14 +24,13 @@ ) from uipath.runtime.errors import UiPathErrorContract, UiPathRuntimeError -from uipath.dev.components.details import RunDetailsPanel -from uipath.dev.components.history import RunHistoryPanel -from uipath.dev.components.new import NewRunPanel -from uipath.dev.models.execution import ExecutionRun -from uipath.dev.models.messages import LogMessage, TraceMessage - -from ._utils._exporter import RunContextExporter -from ._utils._logger import RunContextLogHandler, patch_textual_stderr +from uipath.dev.infrastructure import ( + RunContextExporter, + RunContextLogHandler, + patch_textual_stderr, +) +from uipath.dev.models import ExecutionRun, LogMessage, TraceMessage +from uipath.dev.ui.panels import NewRunPanel, RunDetailsPanel, RunHistoryPanel class UiPathDeveloperConsole(App[Any]): @@ -39,7 +38,7 @@ class UiPathDeveloperConsole(App[Any]): TITLE = "UiPath Developer Console" SUB_TITLE = "Interactive terminal application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts." - CSS_PATH = Path(__file__).parent / "_styles" / "terminal.tcss" + CSS_PATH = Path(__file__).parent / "ui" / "styles" / "terminal.tcss" BINDINGS = [ Binding("q", "quit", "Quit"), diff --git a/src/uipath/dev/infrastructure/__init__.py b/src/uipath/dev/infrastructure/__init__.py new file mode 100644 index 0000000..b3df735 --- /dev/null +++ b/src/uipath/dev/infrastructure/__init__.py @@ -0,0 +1,13 @@ +"""Infrastructure components for UiPath Developer CLI UI integration.""" + +from uipath.dev.infrastructure.logging_handlers import ( + RunContextLogHandler, + patch_textual_stderr, +) +from uipath.dev.infrastructure.tracing_exporter import RunContextExporter + +__all__ = [ + "RunContextExporter", + "RunContextLogHandler", + "patch_textual_stderr", +] diff --git a/src/uipath/dev/_utils/_logger.py b/src/uipath/dev/infrastructure/logging_handlers.py similarity index 96% rename from src/uipath/dev/_utils/_logger.py rename to src/uipath/dev/infrastructure/logging_handlers.py index 20c3972..5e77509 100644 --- a/src/uipath/dev/_utils/_logger.py +++ b/src/uipath/dev/infrastructure/logging_handlers.py @@ -1,3 +1,5 @@ +"""Custom logging handlers for CLI UI integration.""" + from __future__ import annotations import logging @@ -20,6 +22,7 @@ def __init__( run_id: str, callback: Callable[[LogMessage], None], ): + """Initialize RunContextLogHandler with run and callback.""" super().__init__(run_id) self.run_id = run_id self.callback = callback diff --git a/src/uipath/dev/_utils/_exporter.py b/src/uipath/dev/infrastructure/tracing_exporter.py similarity index 96% rename from src/uipath/dev/_utils/_exporter.py rename to src/uipath/dev/infrastructure/tracing_exporter.py index 5a7c8e0..7027a90 100644 --- a/src/uipath/dev/_utils/_exporter.py +++ b/src/uipath/dev/infrastructure/tracing_exporter.py @@ -1,3 +1,5 @@ +"""Custom OpenTelemetry trace exporter for CLI UI integration.""" + import logging from datetime import datetime from typing import Callable, Sequence @@ -18,6 +20,7 @@ def __init__( on_trace: Callable[[TraceMessage], None], on_log: Callable[[LogMessage], None], ): + """Initialize RunContextExporter with callbacks for trace and log messages.""" self.on_trace = on_trace self.on_log = on_log self.logger = logging.getLogger(__name__) diff --git a/src/uipath/dev/models/__init__.py b/src/uipath/dev/models/__init__.py new file mode 100644 index 0000000..c5081aa --- /dev/null +++ b/src/uipath/dev/models/__init__.py @@ -0,0 +1,10 @@ +"""UiPath Dev Console models module.""" + +from uipath.dev.models.execution import ExecutionRun +from uipath.dev.models.messages import LogMessage, TraceMessage + +__all__ = [ + "ExecutionRun", + "LogMessage", + "TraceMessage", +] diff --git a/src/uipath/dev/ui/panels/__init__.py b/src/uipath/dev/ui/panels/__init__.py new file mode 100644 index 0000000..43c16b3 --- /dev/null +++ b/src/uipath/dev/ui/panels/__init__.py @@ -0,0 +1,11 @@ +"""UiPath Dev Console panels module initialization.""" + +from uipath.dev.ui.panels.new_run_panel import NewRunPanel +from uipath.dev.ui.panels.run_details_panel import RunDetailsPanel +from uipath.dev.ui.panels.run_history_panel import RunHistoryPanel + +__all__ = [ + "NewRunPanel", + "RunDetailsPanel", + "RunHistoryPanel", +] diff --git a/src/uipath/dev/components/new.py b/src/uipath/dev/ui/panels/new_run_panel.py similarity index 98% rename from src/uipath/dev/components/new.py rename to src/uipath/dev/ui/panels/new_run_panel.py index 6681455..2dff17f 100644 --- a/src/uipath/dev/components/new.py +++ b/src/uipath/dev/ui/panels/new_run_panel.py @@ -9,7 +9,7 @@ from textual.reactive import reactive from textual.widgets import Button, Select, TabbedContent, TabPane, TextArea -from uipath.dev.components.json_input import JsonInput +from uipath.dev.ui.widgets.json_input import JsonInput def mock_json_from_schema(schema: dict[str, Any]) -> dict[str, Any]: diff --git a/src/uipath/dev/components/details.py b/src/uipath/dev/ui/panels/run_details_panel.py similarity index 100% rename from src/uipath/dev/components/details.py rename to src/uipath/dev/ui/panels/run_details_panel.py diff --git a/src/uipath/dev/components/history.py b/src/uipath/dev/ui/panels/run_history_panel.py similarity index 100% rename from src/uipath/dev/components/history.py rename to src/uipath/dev/ui/panels/run_history_panel.py diff --git a/src/uipath/dev/_styles/terminal.tcss b/src/uipath/dev/ui/styles/terminal.tcss similarity index 100% rename from src/uipath/dev/_styles/terminal.tcss rename to src/uipath/dev/ui/styles/terminal.tcss diff --git a/src/uipath/dev/components/json_input.py b/src/uipath/dev/ui/widgets/json_input.py similarity index 100% rename from src/uipath/dev/components/json_input.py rename to src/uipath/dev/ui/widgets/json_input.py