uipath 2.0.51__py3-none-any.whl → 2.0.52__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_auth.py CHANGED
@@ -7,6 +7,7 @@ import webbrowser
7
7
  import click
8
8
  from dotenv import load_dotenv
9
9
 
10
+ from ..telemetry import track
10
11
  from ._auth._auth_server import HTTPSServer
11
12
  from ._auth._oidc_utils import get_auth_config, get_auth_url
12
13
  from ._auth._portal_service import PortalService, select_tenant
@@ -63,6 +64,7 @@ def set_port():
63
64
  required=False,
64
65
  help="Force new token",
65
66
  )
67
+ @track
66
68
  def auth(domain, force: None | bool = False):
67
69
  """Authenticate with UiPath Cloud Platform."""
68
70
  with console.spinner("Authenticating with UiPath ..."):
uipath/_cli/cli_deploy.py CHANGED
@@ -1,6 +1,7 @@
1
1
  # type: ignore
2
2
  import click
3
3
 
4
+ from ..telemetry import track
4
5
  from .cli_pack import pack
5
6
  from .cli_publish import publish
6
7
 
@@ -21,6 +22,7 @@ from .cli_publish import publish
21
22
  help="Whether to publish to the personal workspace",
22
23
  )
23
24
  @click.argument("root", type=str, default="./")
25
+ @track
24
26
  def deploy(root, feed):
25
27
  """Pack and publish the project."""
26
28
  ctx = click.get_current_context()
uipath/_cli/cli_init.py CHANGED
@@ -7,6 +7,7 @@ from typing import Optional
7
7
 
8
8
  import click
9
9
 
10
+ from ..telemetry import track
10
11
  from ._utils._console import ConsoleLogger
11
12
  from ._utils._input_args import generate_args
12
13
  from ._utils._parse_ast import generate_bindings_json
@@ -52,6 +53,7 @@ def get_user_script(directory: str, entrypoint: Optional[str] = None) -> Optiona
52
53
 
53
54
  @click.command()
54
55
  @click.argument("entrypoint", required=False, default=None)
56
+ @track
55
57
  def init(entrypoint: str) -> None:
56
58
  """Create uipath.json with input/output schemas and bindings."""
57
59
  with console.spinner("Initializing UiPath project ..."):
uipath/_cli/cli_invoke.py CHANGED
@@ -14,6 +14,7 @@ try:
14
14
  except ImportError:
15
15
  import tomli as tomllib
16
16
 
17
+ from ..telemetry import track
17
18
  from ._utils._common import get_env_vars
18
19
  from ._utils._folders import get_personal_workspace_info
19
20
  from ._utils._processes import get_release_info
@@ -50,6 +51,7 @@ def _read_project_details() -> [str, str]:
50
51
  type=click.Path(exists=True),
51
52
  help="File path for the .json input",
52
53
  )
54
+ @track
53
55
  def invoke(
54
56
  entrypoint: Optional[str], input: Optional[str], file: Optional[str]
55
57
  ) -> None:
uipath/_cli/cli_new.py CHANGED
@@ -4,6 +4,7 @@ import shutil
4
4
 
5
5
  import click
6
6
 
7
+ from ..telemetry import track
7
8
  from ._utils._console import ConsoleLogger
8
9
  from .middlewares import Middlewares
9
10
 
@@ -38,6 +39,7 @@ requires-python = ">=3.10"
38
39
 
39
40
  @click.command()
40
41
  @click.argument("name", type=str, default="")
42
+ @track
41
43
  def new(name: str):
42
44
  """Generate a quick-start project."""
43
45
  directory = os.getcwd()
uipath/_cli/cli_pack.py CHANGED
@@ -12,6 +12,7 @@ try:
12
12
  except ImportError:
13
13
  import tomli as tomllib
14
14
 
15
+ from ..telemetry import track
15
16
  from ._utils._console import ConsoleLogger
16
17
 
17
18
  console = ConsoleLogger()
@@ -366,6 +367,7 @@ def display_project_info(config):
366
367
 
367
368
  @click.command()
368
369
  @click.argument("root", type=str, default="./")
370
+ @track
369
371
  def pack(root):
370
372
  """Pack the project."""
371
373
  version = get_project_version(root)
@@ -6,6 +6,7 @@ import click
6
6
  import httpx
7
7
  from dotenv import load_dotenv
8
8
 
9
+ from ..telemetry import track
9
10
  from ._utils._common import get_env_vars
10
11
  from ._utils._console import ConsoleLogger
11
12
  from ._utils._folders import get_personal_workspace_info
@@ -63,6 +64,7 @@ def get_available_feeds(
63
64
  flag_value="personal",
64
65
  help="Whether to publish to the personal workspace",
65
66
  )
67
+ @track
66
68
  def publish(feed):
67
69
  """Publish the package."""
68
70
  current_path = os.getcwd()
uipath/_cli/cli_run.py CHANGED
@@ -9,6 +9,10 @@ from uuid import uuid4
9
9
  import click
10
10
  from dotenv import load_dotenv
11
11
 
12
+ from .._utils.constants import (
13
+ ENV_JOB_ID,
14
+ )
15
+ from ..telemetry import track
12
16
  from ._runtime._contracts import (
13
17
  UiPathRuntimeContext,
14
18
  UiPathRuntimeError,
@@ -108,6 +112,7 @@ Usage: `uipath run <entrypoint_path> <input_arguments> [-f <input_json_file_path
108
112
  type=click.Path(exists=True),
109
113
  help="File path for the .json input",
110
114
  )
115
+ @track(when=lambda *_a, **_kw: env.get(ENV_JOB_ID) is None)
111
116
  def run(
112
117
  entrypoint: Optional[str], input: Optional[str], resume: bool, file: Optional[str]
113
118
  ) -> None:
@@ -8,6 +8,8 @@ ENV_JOB_KEY = "UIPATH_JOB_KEY"
8
8
  ENV_JOB_ID = "UIPATH_JOB_ID"
9
9
  ENV_ROBOT_KEY = "UIPATH_ROBOT_KEY"
10
10
  ENV_TENANT_ID = "UIPATH_TENANT_ID"
11
+ ENV_ORGANIZATION_ID = "UIPATH_ORGANIZATION_ID"
12
+ ENV_TELEMETRY_ENABLED = "TELEMETRY_ENABLED"
11
13
 
12
14
  # Headers
13
15
  HEADER_FOLDER_KEY = "x-uipath-folderkey"
@@ -0,0 +1,3 @@
1
+ from ._track import track # noqa: D104
2
+
3
+ __all__ = ["track"]
@@ -0,0 +1,11 @@
1
+ _CONNECTION_STRING = ""
2
+
3
+ _APP_INSIGHTS_EVENT_MARKER_ATTRIBUTE = "APPLICATION_INSIGHTS_EVENT_MARKER_ATTRIBUTE"
4
+ _OTEL_RESOURCE_ATTRIBUTES = "OTEL_RESOURCE_ATTRIBUTES"
5
+ _SDK_VERSION = "SDK_VERSION"
6
+
7
+ _CODE_FILEPATH = "code.filepath"
8
+ _CODE_FUNCTION = "code.function"
9
+ _CODE_LINENO = "code.lineno"
10
+
11
+ _UNKNOWN = "unknown"
@@ -0,0 +1,125 @@
1
+ import os
2
+ from functools import wraps
3
+ from importlib.metadata import version
4
+ from logging import INFO, LogRecord, getLogger
5
+ from typing import Any, Callable, Dict, Optional, Union
6
+
7
+ from azure.monitor.opentelemetry import configure_azure_monitor
8
+ from opentelemetry.sdk._logs import LoggingHandler
9
+ from opentelemetry.util.types import Attributes
10
+
11
+ from .._utils.constants import (
12
+ ENV_BASE_URL,
13
+ ENV_ORGANIZATION_ID,
14
+ ENV_TELEMETRY_ENABLED,
15
+ ENV_TENANT_ID,
16
+ )
17
+ from ._constants import (
18
+ _APP_INSIGHTS_EVENT_MARKER_ATTRIBUTE,
19
+ _CODE_FILEPATH,
20
+ _CODE_FUNCTION,
21
+ _CODE_LINENO,
22
+ _CONNECTION_STRING,
23
+ _OTEL_RESOURCE_ATTRIBUTES,
24
+ _SDK_VERSION,
25
+ _UNKNOWN,
26
+ )
27
+
28
+ _logger = getLogger(__name__)
29
+ _logger.propagate = False
30
+
31
+
32
+ class _AzureMonitorOpenTelemetryEventHandler(LoggingHandler):
33
+ @staticmethod
34
+ def _get_attributes(record: LogRecord) -> Attributes:
35
+ attributes = dict(LoggingHandler._get_attributes(record) or {})
36
+ attributes[_APP_INSIGHTS_EVENT_MARKER_ATTRIBUTE] = True
37
+ attributes[ENV_TENANT_ID] = os.getenv(ENV_TENANT_ID, _UNKNOWN)
38
+ attributes[ENV_ORGANIZATION_ID] = os.getenv(ENV_ORGANIZATION_ID, _UNKNOWN)
39
+ attributes[ENV_BASE_URL] = os.getenv(ENV_BASE_URL, _UNKNOWN)
40
+ attributes[_SDK_VERSION] = version("uipath")
41
+
42
+ if _CODE_FILEPATH in attributes:
43
+ del attributes[_CODE_FILEPATH]
44
+ if _CODE_FUNCTION in attributes:
45
+ del attributes[_CODE_FUNCTION]
46
+ if _CODE_LINENO in attributes:
47
+ del attributes[_CODE_LINENO]
48
+
49
+ return attributes
50
+
51
+
52
+ class _TelemetryClient:
53
+ """A class to handle telemetry."""
54
+
55
+ _initialized = False
56
+ _enabled = os.getenv(ENV_TELEMETRY_ENABLED, "true").lower() == "true"
57
+
58
+ @staticmethod
59
+ def _initialize():
60
+ """Initialize the telemetry client."""
61
+ if _TelemetryClient._initialized or not _TelemetryClient._enabled:
62
+ return
63
+
64
+ try:
65
+ os.environ[_OTEL_RESOURCE_ATTRIBUTES] = (
66
+ "service.name=uipath-sdk,service.instance.id=" + version("uipath")
67
+ )
68
+ os.environ["OTEL_TRACES_EXPORTER"] = "none"
69
+
70
+ configure_azure_monitor(
71
+ connection_string=_CONNECTION_STRING,
72
+ disable_offline_storage=True,
73
+ )
74
+
75
+ _logger.addHandler(_AzureMonitorOpenTelemetryEventHandler())
76
+ _logger.setLevel(INFO)
77
+
78
+ _TelemetryClient._initialized = True
79
+ except Exception:
80
+ pass
81
+
82
+ @staticmethod
83
+ def _track_method(name: str, attrs: Optional[Dict[str, Any]] = None):
84
+ """Track function invocations."""
85
+ if not _TelemetryClient._enabled:
86
+ return
87
+
88
+ _TelemetryClient._initialize()
89
+
90
+ _logger.info(name, extra=attrs)
91
+
92
+
93
+ def track(
94
+ name_or_func: Optional[Union[str, Callable[..., Any]]] = None,
95
+ *,
96
+ when: Optional[Union[bool, Callable[..., bool]]] = True,
97
+ extra: Optional[Dict[str, Any]] = None,
98
+ ):
99
+ """Decorator that will trace function invocations.
100
+
101
+ Args:
102
+ name_or_func: The name of the event to track or the function itself.
103
+ extra: Extra attributes to add to the telemetry event.
104
+ """
105
+
106
+ def decorator(func: Callable[..., Any]):
107
+ @wraps(func)
108
+ def wrapper(*args, **kwargs):
109
+ event_name = (
110
+ name_or_func if isinstance(name_or_func, str) else func.__name__
111
+ )
112
+
113
+ should_track = when(*args, **kwargs) if callable(when) else when
114
+
115
+ if should_track:
116
+ _TelemetryClient._track_method(event_name, extra)
117
+
118
+ return func(*args, **kwargs)
119
+
120
+ return wrapper
121
+
122
+ if callable(name_or_func):
123
+ return decorator(name_or_func)
124
+
125
+ return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath
3
- Version: 2.0.51
3
+ Version: 2.0.52
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
@@ -14,9 +14,10 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Topic :: Software Development :: Build Tools
16
16
  Requires-Python: >=3.10
17
+ Requires-Dist: azure-monitor-opentelemetry>=1.6.8
17
18
  Requires-Dist: click>=8.1.8
18
19
  Requires-Dist: httpx>=0.28.1
19
- Requires-Dist: opentelemetry-sdk>=1.32.1
20
+ Requires-Dist: opentelemetry-sdk>=1.31.1
20
21
  Requires-Dist: pathlib>=1.0.1
21
22
  Requires-Dist: pydantic>=2.11.1
22
23
  Requires-Dist: python-dotenv>=1.0.1
@@ -6,14 +6,14 @@ uipath/_uipath.py,sha256=6gBDQWyh3u6Nc1q306DERjS_oCKn0VwrfFLaPJqwfYA,3650
6
6
  uipath/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  uipath/_cli/README.md,sha256=GLtCfbeIKZKNnGTCsfSVqRQ27V1btT1i2bSAyW_xZl4,474
8
8
  uipath/_cli/__init__.py,sha256=vGz3vJHkUvgK9_lKdzqiwwHkge1TCALRiOzGGwyr-8E,1885
9
- uipath/_cli/cli_auth.py,sha256=Gg6MR1XnDwPV5Kzn3FANDgbG8KZaCplIqWqBbZUFLOU,3918
10
- uipath/_cli/cli_deploy.py,sha256=lDqZQOsTPe8UyUApSQyFDMChj5HR6_hrEbn5tXtbHQE,608
11
- uipath/_cli/cli_init.py,sha256=qleaHOuXZyqQ001XXFX3m8W2y3pW-miwuvMBl6rHCa4,3699
12
- uipath/_cli/cli_invoke.py,sha256=QsWqSvwB6vFtgeNQ6kiM682d8gEl2VdHOAUJWDTlNYw,3762
13
- uipath/_cli/cli_new.py,sha256=6lLK_p7kRFQPgsc2i9t1v0Su4O1rC7zK55ic3y54QR8,2065
14
- uipath/_cli/cli_pack.py,sha256=-rUGw4vB50QpY-oNmVhIUXXmmFmk7_dhtafqZFBDyZg,14981
15
- uipath/_cli/cli_publish.py,sha256=f6ClG7L-jAzAs77mEOkQuq61w163yQtOZoUI5ArDg70,5973
16
- uipath/_cli/cli_run.py,sha256=ke4UQiqzagv4ST60-mvcC7nh1dQMw_Z6GQ2hAbnspU0,5074
9
+ uipath/_cli/cli_auth.py,sha256=kbZzJ6wLcHM1nlqaEZDGHuMJmhlYxxY_yt1OR_DbdbE,3955
10
+ uipath/_cli/cli_deploy.py,sha256=KPCmQ0c_NYD5JofSDao5r6QYxHshVCRxlWDVnQvlp5w,645
11
+ uipath/_cli/cli_init.py,sha256=6qIjGFwfmeDs_7yzDqfl4zdnpDzlIjPAth0dY7kAP04,3736
12
+ uipath/_cli/cli_invoke.py,sha256=k_T5IG5vm1uO_WEphmV-cMl5Weu04HDNnvGCmSSDQK4,3799
13
+ uipath/_cli/cli_new.py,sha256=9378NYUBc9j-qKVXV7oja-jahfJhXBg8zKVyaon7ctY,2102
14
+ uipath/_cli/cli_pack.py,sha256=8Ahk0vr_8eqMsq9ehhYWNfeII0VIiZVBXMpRF7Dbvtg,15018
15
+ uipath/_cli/cli_publish.py,sha256=Ba0TJ1TSfuQbLU2AIgtM8QWkLHgr4tsAP1CaX12113U,6010
16
+ uipath/_cli/cli_run.py,sha256=CoXx7lKUCq-wbACT5mJByx3FGc1GGe-m40nDt4qGa64,5215
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
@@ -60,7 +60,7 @@ uipath/_utils/_read_overwrites.py,sha256=dODvjNnDjcYOxVKnt0KqqqXmysULLBObKaEF8gJ
60
60
  uipath/_utils/_request_override.py,sha256=_vibG78vEDWS3JKg2cJ5l6tpoBMLChUOauiqL1ozFPc,530
61
61
  uipath/_utils/_request_spec.py,sha256=iCtBLqtbWUpFG5g1wtIZBzSupKsfaRLiQFoFc_4B70Q,747
62
62
  uipath/_utils/_user_agent.py,sha256=pVJkFYacGwaQBomfwWVAvBQgdBUo62e4n3-fLIajWUU,563
63
- uipath/_utils/constants.py,sha256=xW-gbRasjdOwSj2rke4wfRCml69710oUaDNJcwFAZug,775
63
+ uipath/_utils/constants.py,sha256=6jtBwOXhf6LPM6fTNAf3rh--j6Ls2W5lIYieBTSLoQM,866
64
64
  uipath/models/__init__.py,sha256=tQF2CbEjmB_1sqL1lJrtVe3K2o8F0LKzzoXKiUUBqxc,1178
65
65
  uipath/models/action_schema.py,sha256=lKDhP7Eix23fFvfQrqqNmSOiPyyNF6tiRpUu0VZIn_M,714
66
66
  uipath/models/actions.py,sha256=ekSH4YUQR4KPOH-heBm9yOgOfirndx0In4_S4VYWeEU,2993
@@ -76,12 +76,15 @@ uipath/models/job.py,sha256=f9L6_kg_VP0dAYvdcz1DWEWzy4NZPdlpHREod0uNK1E,3099
76
76
  uipath/models/llm_gateway.py,sha256=0sl5Wtve94V14H3AHwmJSoXAhoc-Fai3wJxP8HrnBPg,1994
77
77
  uipath/models/processes.py,sha256=Atvfrt6X4TYST3iA62jpS_Uxc3hg6uah11p-RaKZ6dk,2029
78
78
  uipath/models/queues.py,sha256=N_s0GKucbyjh0RnO8SxPk6wlRgvq8KIIYsfaoIY46tM,6446
79
+ uipath/telemetry/__init__.py,sha256=Wna32UFzZR66D-RzTKlPWlvji9i2HJb82NhHjCCXRjY,61
80
+ uipath/telemetry/_constants.py,sha256=wULKBQDsr_wcc6Hl3lWLMughrPn48S7zGmTOMiESz3I,312
81
+ uipath/telemetry/_track.py,sha256=N2KHCXNaC7nsxI2oqHj8zYkBqyMJSNkadek53TmL_og,3738
79
82
  uipath/tracing/__init__.py,sha256=GimSzv6qkCOlHOG1WtjYKJsZqcXpA28IgoXfR33JhiA,139
80
83
  uipath/tracing/_otel_exporters.py,sha256=x0PDPmDKJcxashsuehVsSsqBCzRr6WsNFaq_3_HS5F0,3014
81
84
  uipath/tracing/_traced.py,sha256=GFxOp73jk0vGTN_H7YZOOsEl9rVLaEhXGztMiYKIA-8,16634
82
85
  uipath/tracing/_utils.py,sha256=5SwsTGpHkIouXBndw-u8eCLnN4p7LM8DsTCCuf2jJgs,10165
83
- uipath-2.0.51.dist-info/METADATA,sha256=47ZdjgQM8vSG8AUablbu0_DYJ0X518Wsc2BB1F9EYBo,6254
84
- uipath-2.0.51.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
85
- uipath-2.0.51.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
86
- uipath-2.0.51.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
87
- uipath-2.0.51.dist-info/RECORD,,
86
+ uipath-2.0.52.dist-info/METADATA,sha256=dCTRBp4flmPG4H5CPIV06TF6ENiCBy-a4lGOT3ZN6AU,6304
87
+ uipath-2.0.52.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
88
+ uipath-2.0.52.dist-info/entry_points.txt,sha256=9C2_29U6Oq1ExFu7usihR-dnfIVNSKc-0EFbh0rskB4,43
89
+ uipath-2.0.52.dist-info/licenses/LICENSE,sha256=-KBavWXepyDjimmzH5fVAsi-6jNVpIKFc2kZs0Ri4ng,1058
90
+ uipath-2.0.52.dist-info/RECORD,,