rocket-welder-sdk 1.1.33__tar.gz → 1.1.34a2__tar.gz
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.
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/PKG-INFO +1 -1
- rocket_welder_sdk-1.1.34a2/VERSION +1 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/__init__.py +15 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/rocket_welder_client.py +57 -0
- rocket_welder_sdk-1.1.34a2/rocket_welder_sdk/session_id.py +115 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/PKG-INFO +1 -1
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/SOURCES.txt +2 -0
- rocket_welder_sdk-1.1.34a2/tests/test_session_id.py +130 -0
- rocket_welder_sdk-1.1.33/VERSION +0 -1
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/MANIFEST.in +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/README.md +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/logo.png +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/pyproject.toml +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/bytes_size.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/connection_string.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/controllers.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/external_controls/__init__.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/external_controls/contracts.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/external_controls/contracts_old.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/frame_metadata.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/gst_metadata.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/__init__.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/connection_strings.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/data_context.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/schema.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/transport_protocol.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/keypoints_protocol.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/opencv_controller.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/periodic_timer.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/py.typed +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/segmentation_result.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/__init__.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/frame_sink.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/frame_source.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/nng_transport.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/stream_transport.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/tcp_transport.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/unix_socket_transport.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/__init__.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/controls.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/icons.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/ui_events_projection.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/ui_service.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/value_types.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/dependency_links.txt +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/requires.txt +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/top_level.txt +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/setup.cfg +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/setup.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_bytes_size.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_connection_string.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_controllers.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_external_controls_serialization.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_external_controls_serialization_v2.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_frame_metadata.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_gst_metadata.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_high_level_api.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_icons.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_keypoints_cross_platform.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_keypoints_protocol.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_rocket_welder_client.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_segmentation_cross_platform.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_segmentation_result.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_transport_cross_platform.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_ui_controls.py +0 -0
- {rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_ui_service_happy_path.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rocket-welder-sdk
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.34a2
|
|
4
4
|
Summary: High-performance video streaming SDK for RocketWelder services using ZeroBuffer IPC
|
|
5
5
|
Home-page: https://github.com/modelingevolution/rocket-welder-sdk
|
|
6
6
|
Author: ModelingEvolution
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.34a2
|
|
@@ -15,6 +15,14 @@ from .gst_metadata import GstCaps, GstMetadata
|
|
|
15
15
|
from .opencv_controller import OpenCvController
|
|
16
16
|
from .periodic_timer import PeriodicTimer, PeriodicTimerSync
|
|
17
17
|
from .rocket_welder_client import RocketWelderClient
|
|
18
|
+
from .session_id import (
|
|
19
|
+
get_actions_url,
|
|
20
|
+
get_keypoints_url,
|
|
21
|
+
get_nng_urls,
|
|
22
|
+
get_segmentation_url,
|
|
23
|
+
get_session_id_from_env,
|
|
24
|
+
parse_session_id,
|
|
25
|
+
)
|
|
18
26
|
|
|
19
27
|
# Alias for backward compatibility and README examples
|
|
20
28
|
Client = RocketWelderClient
|
|
@@ -58,4 +66,11 @@ __all__ = [
|
|
|
58
66
|
"PeriodicTimerSync",
|
|
59
67
|
"Protocol",
|
|
60
68
|
"RocketWelderClient",
|
|
69
|
+
# SessionId utilities for NNG URL generation
|
|
70
|
+
"get_actions_url",
|
|
71
|
+
"get_keypoints_url",
|
|
72
|
+
"get_nng_urls",
|
|
73
|
+
"get_segmentation_url",
|
|
74
|
+
"get_session_id_from_env",
|
|
75
|
+
"parse_session_id",
|
|
61
76
|
]
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/rocket_welder_client.py
RENAMED
|
@@ -16,6 +16,8 @@ from .connection_string import ConnectionMode, ConnectionString, Protocol
|
|
|
16
16
|
from .controllers import DuplexShmController, IController, OneWayShmController
|
|
17
17
|
from .frame_metadata import FrameMetadata # noqa: TC001 - used at runtime in callbacks
|
|
18
18
|
from .opencv_controller import OpenCvController
|
|
19
|
+
from .session_id import get_nng_urls, get_session_id_from_env
|
|
20
|
+
from .transport.nng_transport import NngFrameSink
|
|
19
21
|
|
|
20
22
|
if TYPE_CHECKING:
|
|
21
23
|
import numpy.typing as npt
|
|
@@ -53,6 +55,9 @@ class RocketWelderClient:
|
|
|
53
55
|
self._controller: Optional[IController] = None
|
|
54
56
|
self._lock = threading.Lock()
|
|
55
57
|
|
|
58
|
+
# NNG publishers for streaming results (auto-created if SessionId env var is set)
|
|
59
|
+
self._nng_publishers: dict[str, NngFrameSink] = {}
|
|
60
|
+
|
|
56
61
|
# Preview support
|
|
57
62
|
self._preview_enabled = (
|
|
58
63
|
self._connection.parameters.get("preview", "false").lower() == "true"
|
|
@@ -72,6 +77,44 @@ class RocketWelderClient:
|
|
|
72
77
|
with self._lock:
|
|
73
78
|
return self._controller is not None and self._controller.is_running
|
|
74
79
|
|
|
80
|
+
@property
|
|
81
|
+
def nng_publishers(self) -> dict[str, NngFrameSink]:
|
|
82
|
+
"""Get NNG publishers for streaming results.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Dictionary with 'segmentation', 'keypoints', 'actions' keys.
|
|
86
|
+
Empty if SessionId env var was not set at startup.
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
client.nng_publishers["segmentation"].write_frame(seg_data)
|
|
90
|
+
"""
|
|
91
|
+
return self._nng_publishers
|
|
92
|
+
|
|
93
|
+
def _create_nng_publishers(self, session_id: str) -> None:
|
|
94
|
+
"""Create NNG publishers for result streaming.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
session_id: SessionId string (e.g., "ps-{guid}")
|
|
98
|
+
"""
|
|
99
|
+
try:
|
|
100
|
+
urls = get_nng_urls(session_id)
|
|
101
|
+
|
|
102
|
+
for name, url in urls.items():
|
|
103
|
+
sink = NngFrameSink.create_publisher(url)
|
|
104
|
+
self._nng_publishers[name] = sink
|
|
105
|
+
logger.info("NNG publisher ready: %s at %s", name, url)
|
|
106
|
+
|
|
107
|
+
logger.info(
|
|
108
|
+
"NNG publishers created for SessionId=%s: seg=%s, kp=%s, actions=%s",
|
|
109
|
+
session_id,
|
|
110
|
+
urls["segmentation"],
|
|
111
|
+
urls["keypoints"],
|
|
112
|
+
urls["actions"],
|
|
113
|
+
)
|
|
114
|
+
except Exception as ex:
|
|
115
|
+
logger.warning("Failed to create NNG publishers: %s", ex)
|
|
116
|
+
# Don't fail start() - NNG is optional for backwards compatibility
|
|
117
|
+
|
|
75
118
|
def get_metadata(self) -> Optional[GstMetadata]:
|
|
76
119
|
"""
|
|
77
120
|
Get the current GStreamer metadata.
|
|
@@ -119,6 +162,11 @@ class RocketWelderClient:
|
|
|
119
162
|
else:
|
|
120
163
|
raise ValueError(f"Unsupported protocol: {self._connection.protocol}")
|
|
121
164
|
|
|
165
|
+
# Auto-create NNG publishers if SessionId env var is set
|
|
166
|
+
session_id = get_session_id_from_env()
|
|
167
|
+
if session_id:
|
|
168
|
+
self._create_nng_publishers(session_id)
|
|
169
|
+
|
|
122
170
|
# If preview is enabled, wrap the callback to capture frames
|
|
123
171
|
if self._preview_enabled:
|
|
124
172
|
self._original_callback = on_frame
|
|
@@ -189,6 +237,15 @@ class RocketWelderClient:
|
|
|
189
237
|
if self._preview_enabled:
|
|
190
238
|
self._preview_queue.put(None) # Sentinel value
|
|
191
239
|
|
|
240
|
+
# Clean up NNG publishers
|
|
241
|
+
for name, sink in self._nng_publishers.items():
|
|
242
|
+
try:
|
|
243
|
+
sink.close()
|
|
244
|
+
logger.debug("Closed NNG publisher: %s", name)
|
|
245
|
+
except Exception as ex:
|
|
246
|
+
logger.warning("Failed to close NNG publisher %s: %s", name, ex)
|
|
247
|
+
self._nng_publishers.clear()
|
|
248
|
+
|
|
192
249
|
logger.info("RocketWelder client stopped")
|
|
193
250
|
|
|
194
251
|
def show(self, cancellation_token: Optional[threading.Event] = None) -> None:
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""SessionId parsing utilities for NNG URL generation.
|
|
2
|
+
|
|
3
|
+
SessionId format: ps-{guid} (e.g., ps-a1b2c3d4-e5f6-7890-abcd-ef1234567890)
|
|
4
|
+
Prefix "ps" = PipelineSession.
|
|
5
|
+
|
|
6
|
+
This module provides utilities to:
|
|
7
|
+
1. Parse SessionId from environment variable
|
|
8
|
+
2. Extract the Guid portion
|
|
9
|
+
3. Generate NNG IPC URLs for streaming results
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import logging
|
|
15
|
+
import os
|
|
16
|
+
import uuid
|
|
17
|
+
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
19
|
+
|
|
20
|
+
SESSION_ID_PREFIX = "ps-"
|
|
21
|
+
SESSION_ID_ENV_VAR = "SessionId"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse_session_id(session_id: str) -> uuid.UUID:
|
|
25
|
+
"""Parse SessionId (ps-{guid}) to extract Guid.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
session_id: SessionId string (e.g., "ps-a1b2c3d4-...")
|
|
29
|
+
|
|
30
|
+
Returns:
|
|
31
|
+
UUID extracted from SessionId
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ValueError: If session_id format is invalid
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
>>> parse_session_id("ps-a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
38
|
+
UUID('a1b2c3d4-e5f6-7890-abcd-ef1234567890')
|
|
39
|
+
>>> parse_session_id("a1b2c3d4-e5f6-7890-abcd-ef1234567890") # backwards compat
|
|
40
|
+
UUID('a1b2c3d4-e5f6-7890-abcd-ef1234567890')
|
|
41
|
+
"""
|
|
42
|
+
if session_id.startswith(SESSION_ID_PREFIX):
|
|
43
|
+
return uuid.UUID(session_id[len(SESSION_ID_PREFIX) :])
|
|
44
|
+
# Fallback: try parsing as raw guid for backwards compatibility
|
|
45
|
+
return uuid.UUID(session_id)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_session_id_from_env() -> str | None:
|
|
49
|
+
"""Get SessionId from environment variable.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
SessionId string or None if not set
|
|
53
|
+
"""
|
|
54
|
+
return os.environ.get(SESSION_ID_ENV_VAR)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_nng_urls(session_id: str) -> dict[str, str]:
|
|
58
|
+
"""Generate NNG IPC URLs from SessionId.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
session_id: SessionId string (e.g., "ps-a1b2c3d4-...")
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Dictionary with 'segmentation', 'keypoints', 'actions' URLs
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
>>> urls = get_nng_urls("ps-a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
68
|
+
>>> urls["segmentation"]
|
|
69
|
+
'ipc:///tmp/rw-a1b2c3d4-e5f6-7890-abcd-ef1234567890-seg.sock'
|
|
70
|
+
"""
|
|
71
|
+
guid = parse_session_id(session_id)
|
|
72
|
+
return {
|
|
73
|
+
"segmentation": f"ipc:///tmp/rw-{guid}-seg.sock",
|
|
74
|
+
"keypoints": f"ipc:///tmp/rw-{guid}-kp.sock",
|
|
75
|
+
"actions": f"ipc:///tmp/rw-{guid}-actions.sock",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def get_segmentation_url(session_id: str) -> str:
|
|
80
|
+
"""Get NNG URL for segmentation stream.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
session_id: SessionId string (e.g., "ps-a1b2c3d4-...")
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
IPC URL for segmentation stream
|
|
87
|
+
"""
|
|
88
|
+
guid = parse_session_id(session_id)
|
|
89
|
+
return f"ipc:///tmp/rw-{guid}-seg.sock"
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def get_keypoints_url(session_id: str) -> str:
|
|
93
|
+
"""Get NNG URL for keypoints stream.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
session_id: SessionId string (e.g., "ps-a1b2c3d4-...")
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
IPC URL for keypoints stream
|
|
100
|
+
"""
|
|
101
|
+
guid = parse_session_id(session_id)
|
|
102
|
+
return f"ipc:///tmp/rw-{guid}-kp.sock"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def get_actions_url(session_id: str) -> str:
|
|
106
|
+
"""Get NNG URL for actions stream.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
session_id: SessionId string (e.g., "ps-a1b2c3d4-...")
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
IPC URL for actions stream
|
|
113
|
+
"""
|
|
114
|
+
guid = parse_session_id(session_id)
|
|
115
|
+
return f"ipc:///tmp/rw-{guid}-actions.sock"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rocket-welder-sdk
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.34a2
|
|
4
4
|
Summary: High-performance video streaming SDK for RocketWelder services using ZeroBuffer IPC
|
|
5
5
|
Home-page: https://github.com/modelingevolution/rocket-welder-sdk
|
|
6
6
|
Author: ModelingEvolution
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/SOURCES.txt
RENAMED
|
@@ -17,6 +17,7 @@ rocket_welder_sdk/periodic_timer.py
|
|
|
17
17
|
rocket_welder_sdk/py.typed
|
|
18
18
|
rocket_welder_sdk/rocket_welder_client.py
|
|
19
19
|
rocket_welder_sdk/segmentation_result.py
|
|
20
|
+
rocket_welder_sdk/session_id.py
|
|
20
21
|
rocket_welder_sdk.egg-info/PKG-INFO
|
|
21
22
|
rocket_welder_sdk.egg-info/SOURCES.txt
|
|
22
23
|
rocket_welder_sdk.egg-info/dependency_links.txt
|
|
@@ -57,6 +58,7 @@ tests/test_keypoints_protocol.py
|
|
|
57
58
|
tests/test_rocket_welder_client.py
|
|
58
59
|
tests/test_segmentation_cross_platform.py
|
|
59
60
|
tests/test_segmentation_result.py
|
|
61
|
+
tests/test_session_id.py
|
|
60
62
|
tests/test_transport_cross_platform.py
|
|
61
63
|
tests/test_ui_controls.py
|
|
62
64
|
tests/test_ui_service_happy_path.py
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Tests for session_id module."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import uuid
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from rocket_welder_sdk.session_id import (
|
|
10
|
+
SESSION_ID_PREFIX,
|
|
11
|
+
get_actions_url,
|
|
12
|
+
get_keypoints_url,
|
|
13
|
+
get_nng_urls,
|
|
14
|
+
get_segmentation_url,
|
|
15
|
+
get_session_id_from_env,
|
|
16
|
+
parse_session_id,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class TestParseSessionId:
|
|
21
|
+
"""Tests for parse_session_id function."""
|
|
22
|
+
|
|
23
|
+
def test_parse_with_prefix(self) -> None:
|
|
24
|
+
"""parse_session_id handles ps-{guid} format."""
|
|
25
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
26
|
+
session_id = f"ps-{guid}"
|
|
27
|
+
|
|
28
|
+
result = parse_session_id(session_id)
|
|
29
|
+
|
|
30
|
+
assert result == guid
|
|
31
|
+
|
|
32
|
+
def test_parse_without_prefix(self) -> None:
|
|
33
|
+
"""parse_session_id handles raw guid for backwards compat."""
|
|
34
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
35
|
+
session_id = str(guid)
|
|
36
|
+
|
|
37
|
+
result = parse_session_id(session_id)
|
|
38
|
+
|
|
39
|
+
assert result == guid
|
|
40
|
+
|
|
41
|
+
def test_parse_invalid_raises_value_error(self) -> None:
|
|
42
|
+
"""parse_session_id raises ValueError for invalid input."""
|
|
43
|
+
with pytest.raises(ValueError):
|
|
44
|
+
parse_session_id("invalid-session-id")
|
|
45
|
+
|
|
46
|
+
def test_parse_empty_raises_value_error(self) -> None:
|
|
47
|
+
"""parse_session_id raises ValueError for empty string."""
|
|
48
|
+
with pytest.raises(ValueError):
|
|
49
|
+
parse_session_id("")
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class TestGetNngUrls:
|
|
53
|
+
"""Tests for get_nng_urls function."""
|
|
54
|
+
|
|
55
|
+
def test_generates_correct_urls(self) -> None:
|
|
56
|
+
"""get_nng_urls generates correct IPC URLs."""
|
|
57
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
58
|
+
session_id = f"ps-{guid}"
|
|
59
|
+
|
|
60
|
+
urls = get_nng_urls(session_id)
|
|
61
|
+
|
|
62
|
+
assert urls["segmentation"] == f"ipc:///tmp/rw-{guid}-seg.sock"
|
|
63
|
+
assert urls["keypoints"] == f"ipc:///tmp/rw-{guid}-kp.sock"
|
|
64
|
+
assert urls["actions"] == f"ipc:///tmp/rw-{guid}-actions.sock"
|
|
65
|
+
|
|
66
|
+
def test_works_with_raw_guid(self) -> None:
|
|
67
|
+
"""get_nng_urls works with raw guid for backwards compat."""
|
|
68
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
69
|
+
session_id = str(guid)
|
|
70
|
+
|
|
71
|
+
urls = get_nng_urls(session_id)
|
|
72
|
+
|
|
73
|
+
assert f"{guid}" in urls["segmentation"]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class TestGetIndividualUrls:
|
|
77
|
+
"""Tests for individual URL getter functions."""
|
|
78
|
+
|
|
79
|
+
def test_get_segmentation_url(self) -> None:
|
|
80
|
+
"""get_segmentation_url returns correct URL."""
|
|
81
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
82
|
+
session_id = f"ps-{guid}"
|
|
83
|
+
|
|
84
|
+
url = get_segmentation_url(session_id)
|
|
85
|
+
|
|
86
|
+
assert url == f"ipc:///tmp/rw-{guid}-seg.sock"
|
|
87
|
+
|
|
88
|
+
def test_get_keypoints_url(self) -> None:
|
|
89
|
+
"""get_keypoints_url returns correct URL."""
|
|
90
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
91
|
+
session_id = f"ps-{guid}"
|
|
92
|
+
|
|
93
|
+
url = get_keypoints_url(session_id)
|
|
94
|
+
|
|
95
|
+
assert url == f"ipc:///tmp/rw-{guid}-kp.sock"
|
|
96
|
+
|
|
97
|
+
def test_get_actions_url(self) -> None:
|
|
98
|
+
"""get_actions_url returns correct URL."""
|
|
99
|
+
guid = uuid.UUID("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
|
100
|
+
session_id = f"ps-{guid}"
|
|
101
|
+
|
|
102
|
+
url = get_actions_url(session_id)
|
|
103
|
+
|
|
104
|
+
assert url == f"ipc:///tmp/rw-{guid}-actions.sock"
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class TestGetSessionIdFromEnv:
|
|
108
|
+
"""Tests for get_session_id_from_env function."""
|
|
109
|
+
|
|
110
|
+
def test_returns_value_when_set(self) -> None:
|
|
111
|
+
"""get_session_id_from_env returns value when SessionId is set."""
|
|
112
|
+
with mock.patch.dict(os.environ, {"SessionId": "ps-test-guid"}):
|
|
113
|
+
result = get_session_id_from_env()
|
|
114
|
+
assert result == "ps-test-guid"
|
|
115
|
+
|
|
116
|
+
def test_returns_none_when_not_set(self) -> None:
|
|
117
|
+
"""get_session_id_from_env returns None when SessionId not set."""
|
|
118
|
+
with mock.patch.dict(os.environ, clear=True):
|
|
119
|
+
# Ensure SessionId is not set
|
|
120
|
+
os.environ.pop("SessionId", None)
|
|
121
|
+
result = get_session_id_from_env()
|
|
122
|
+
assert result is None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class TestSessionIdPrefix:
|
|
126
|
+
"""Tests for SESSION_ID_PREFIX constant."""
|
|
127
|
+
|
|
128
|
+
def test_prefix_is_ps_dash(self) -> None:
|
|
129
|
+
"""SESSION_ID_PREFIX is 'ps-'."""
|
|
130
|
+
assert SESSION_ID_PREFIX == "ps-"
|
rocket_welder_sdk-1.1.33/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.1.33
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/connection_string.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/data_context.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/high_level/schema.py
RENAMED
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/keypoints_protocol.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/opencv_controller.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/segmentation_result.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/__init__.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/frame_sink.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/frame_source.py
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/nng_transport.py
RENAMED
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/transport/tcp_transport.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk/ui/ui_events_projection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/rocket_welder_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_keypoints_cross_platform.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_segmentation_cross_platform.py
RENAMED
|
File without changes
|
|
File without changes
|
{rocket_welder_sdk-1.1.33 → rocket_welder_sdk-1.1.34a2}/tests/test_transport_cross_platform.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|