phystack-hub-client 0.2.4__tar.gz → 0.2.6__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.
Files changed (24) hide show
  1. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/PKG-INFO +7 -6
  2. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/pyproject.toml +17 -6
  3. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/__init__.py +8 -1
  4. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/client.py +13 -0
  5. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/phyhub_connection.py +5 -0
  6. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/.gitignore +0 -0
  7. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/README.md +0 -0
  8. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/examples/browser_test_backend.py +0 -0
  9. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/scripts/python-node-test.sh +0 -0
  10. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/scripts/webrtc-test.sh +0 -0
  11. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/instances/__init__.py +0 -0
  12. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/instances/base_instance.py +0 -0
  13. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/instances/edge_instance.py +0 -0
  14. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/instances/peripheral_instance.py +0 -0
  15. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/__init__.py +0 -0
  16. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/signals.py +0 -0
  17. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/webrtc/__init__.py +0 -0
  18. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/webrtc/data_channel.py +0 -0
  19. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/services/webrtc/media_stream.py +0 -0
  20. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/twin_messaging.py +0 -0
  21. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/twin_registry.py +0 -0
  22. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/types/__init__.py +0 -0
  23. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/src/phystack/hub_client/types/twin_types.py +0 -0
  24. {phystack_hub_client-0.2.4 → phystack_hub_client-0.2.6}/tests/test_communication.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phystack-hub-client
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Python client for PhyHub - events, actions, DataChannel, and MediaStream
5
5
  Project-URL: Homepage, https://github.com/phystack/phystack-pypi
6
6
  Project-URL: Documentation, https://docs.phystack.com
@@ -15,11 +15,12 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Requires-Python: >=3.10
18
- Requires-Dist: aiohttp>=3.9.0
19
- Requires-Dist: aiortc>=1.6.0
20
- Requires-Dist: numpy>=1.24.0
21
- Requires-Dist: opencv-python>=4.8.0
22
- Requires-Dist: python-socketio[asyncio-client]>=5.10.0
18
+ Requires-Dist: aiohttp<4.0.0,>=3.9.0
19
+ Requires-Dist: aiortc<2.0.0,>=1.6.0
20
+ Requires-Dist: numpy<3.0.0,>=1.24.0
21
+ Requires-Dist: opencv-python<5.0.0,>=4.8.0
22
+ Requires-Dist: python-engineio<4.12.0,>=4.9.0
23
+ Requires-Dist: python-socketio[asyncio-client]<5.12.0,>=5.11.0
23
24
  Provides-Extra: dev
24
25
  Requires-Dist: black>=23.0.0; extra == 'dev'
25
26
  Requires-Dist: mypy>=1.5.0; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "phystack-hub-client"
7
- version = "0.2.4"
7
+ version = "0.2.6"
8
8
  description = "Python client for PhyHub - events, actions, DataChannel, and MediaStream"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -22,11 +22,22 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.12",
23
23
  ]
24
24
  dependencies = [
25
- "python-socketio[asyncio_client]>=5.10.0",
26
- "aiohttp>=3.9.0",
27
- "aiortc>=1.6.0",
28
- "opencv-python>=4.8.0",
29
- "numpy>=1.24.0",
25
+ # Pinned to narrow ranges tested against the PhyOS hub socket.io server
26
+ # (socket.io 4.8.1 / engine.io 6.6.4). python-engineio 4.12+ has a bug
27
+ # in the WebSocket upgrade error path: _connect_websocket can pass a
28
+ # WebSocketError object into the packet decoder, causing
29
+ # "TypeError: object of type 'WebSocketError' has no len()".
30
+ "python-socketio[asyncio_client]>=5.11.0,<5.12.0",
31
+ "python-engineio>=4.9.0,<4.12.0",
32
+ # aiohttp 4.x is an announced future breaking release; cap below it.
33
+ "aiohttp>=3.9.0,<4.0.0",
34
+ # aiortc has had minor-version API breaks; cap at next major.
35
+ "aiortc>=1.6.0,<2.0.0",
36
+ # opencv-python 5.x is not released yet; cap at next major.
37
+ "opencv-python>=4.8.0,<5.0.0",
38
+ # numpy 2.0 was a large ABI change. Allow 2.x but cap before the next
39
+ # unreleased major to avoid surprise breaks.
40
+ "numpy>=1.24.0,<3.0.0",
30
41
  ]
31
42
 
32
43
  [project.optional-dependencies]
@@ -10,6 +10,12 @@ A Python client for PhyHub that provides:
10
10
  - Settings API
11
11
 
12
12
  Usage:
13
+ from phystack.hub_client import connect_phy_client
14
+
15
+ client = await connect_phy_client()
16
+ instance = await client.get_instance()
17
+
18
+ Or with context manager:
13
19
  from phystack.hub_client import PhyHubClient
14
20
 
15
21
  async with PhyHubClient.from_env() as client:
@@ -38,7 +44,7 @@ Usage:
38
44
  stream = await instance.get_media_stream(peer_twin_id)
39
45
  """
40
46
 
41
- from phystack.hub_client.client import PhyHubClient
47
+ from phystack.hub_client.client import PhyHubClient, connect_phy_client
42
48
  from phystack.hub_client.types.twin_types import (
43
49
  TwinMessageResult,
44
50
  TwinMessageResultStatus,
@@ -78,6 +84,7 @@ __version__ = "0.1.0"
78
84
  __all__ = [
79
85
  # Client
80
86
  "PhyHubClient",
87
+ "connect_phy_client",
81
88
  # Instances
82
89
  "BaseInstance",
83
90
  "EdgeInstance",
@@ -797,3 +797,16 @@ class PhyHubClient:
797
797
  async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
798
798
  """Async context manager exit."""
799
799
  await self.disconnect()
800
+
801
+
802
+ async def connect_phy_client() -> PhyHubClient:
803
+ """Connect to PhyHub in one call (matches Node.js connectPhyClient).
804
+
805
+ Reads connection config from environment variables and connects.
806
+
807
+ Returns:
808
+ Connected PhyHubClient instance.
809
+ """
810
+ client = PhyHubClient.from_env()
811
+ await client.connect()
812
+ return client
@@ -225,10 +225,15 @@ class PhyHubConnection:
225
225
  timeout = 3 if mode == ConnectionMode.SIMULATOR else 5
226
226
 
227
227
  try:
228
+ # Force WebSocket-only transport to match the Node hub client's
229
+ # behavior. The default polling -> WebSocket upgrade path triggers
230
+ # a python-engineio bug where a WebSocketError object is passed
231
+ # into the packet decoder on upgrade failure.
228
232
  await self._sio.connect(
229
233
  self.config.url,
230
234
  auth=auth,
231
235
  wait_timeout=timeout,
236
+ transports=["websocket"],
232
237
  )
233
238
 
234
239
  # Wait for connection confirmation