reactor-sdk 0.1.0__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.
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: reactor-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for Reactor - Real-time AI video streaming
5
+ Project-URL: Homepage, https://reactor.inc
6
+ Project-URL: Documentation, https://docs.reactor.inc
7
+ Project-URL: Repository, https://github.com/reactor-team/py-sdk
8
+ Author-email: Reactor Technologies <support@reactor.inc>
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Multimedia :: Video
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: aiohttp>=3.9.0
21
+ Requires-Dist: aiortc>=1.9.0
22
+ Requires-Dist: av>=12.0.0
23
+ Requires-Dist: numpy>=1.24.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
27
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Reactor Python SDK
32
+
33
+ [![PyPI version](https://img.shields.io/pypi/v/reactor-sdk)](https://pypi.org/project/reactor-sdk/)
34
+ [![PyPI downloads](https://img.shields.io/pypi/dm/reactor-sdk)](https://pypi.org/project/reactor-sdk/)
35
+ [![build](https://img.shields.io/github/actions/workflow/status/reactor-team/py-sdk/ci.yml?branch=main)](https://github.com/reactor-team/py-sdk/actions)
36
+ [![license](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
37
+
38
+ Python SDK for Reactor - Real-time AI video streaming platform.
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install reactor-sdk
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ ```python
49
+ import asyncio
50
+ from reactor_sdk import Reactor, ReactorStatus
51
+
52
+ async def main():
53
+ # Create a Reactor instance with your API key
54
+ reactor = Reactor(
55
+ model_name="my-model",
56
+ api_key="REACTOR_API_KEY", # SDK automatically fetches JWT token
57
+ )
58
+
59
+ # Use decorators for clean event handling
60
+ @reactor.on_frame
61
+ def handle_frame(frame):
62
+ print(f"Received frame: {frame.shape}")
63
+
64
+ @reactor.on_message
65
+ def handle_message(msg):
66
+ print(f"Message: {msg}")
67
+
68
+ @reactor.on_status(ReactorStatus.READY)
69
+ def handle_ready(status):
70
+ print("Connected and ready!")
71
+
72
+ @reactor.on_error
73
+ def handle_error(error):
74
+ print(f"Error: {error}")
75
+
76
+ # Connect to the model (JWT token is fetched automatically)
77
+ await reactor.connect()
78
+
79
+ # Send commands
80
+ await reactor.send_command("setParameter", {"value": 0.5})
81
+
82
+ # Keep running
83
+ try:
84
+ while reactor.get_status() == ReactorStatus.READY:
85
+ await asyncio.sleep(0.1)
86
+ finally:
87
+ await reactor.disconnect()
88
+
89
+ if __name__ == "__main__":
90
+ asyncio.run(main())
91
+ ```
92
+
93
+ ## Features
94
+
95
+ - **WebRTC video streaming** via aiortc
96
+ - **Event-driven API** matching the JavaScript SDK
97
+ - **Frame callbacks** for single-frame access
98
+ - **Video input** support for sending video to models
99
+ - **Local development** mode for testing
100
+ - **Full type hints** for IDE support
101
+
102
+ ## API Reference
103
+
104
+ ### Reactor
105
+
106
+ The main class for connecting to Reactor models.
107
+
108
+ ```python
109
+ from reactor_sdk import Reactor
110
+
111
+ # Production usage with API key
112
+ reactor = Reactor(
113
+ model_name="my-model",
114
+ api_key="REACTOR_API_KEY", # SDK fetches JWT automatically
115
+ )
116
+
117
+ # Local development (no API key needed)
118
+ reactor = Reactor(
119
+ model_name="my-model",
120
+ local=True,
121
+ )
122
+ ```
123
+
124
+ The `Reactor` type can also be used for type annotations:
125
+
126
+ ```python
127
+ from reactor_sdk import Reactor
128
+
129
+ def process_reactor(reactor: Reactor) -> None:
130
+ # reactor has full type hints for all methods
131
+ pass
132
+ ```
133
+
134
+ #### Methods
135
+
136
+ - `await reactor.connect()` - Connect to the model (fetches JWT automatically if API key provided)
137
+ - `await reactor.disconnect(recoverable: bool = False)` - Disconnect
138
+ - `await reactor.reconnect()` - Reconnect to existing session
139
+ - `await reactor.send_command(command: str, data: dict)` - Send a command
140
+ - `await reactor.publish_track(track: MediaStreamTrack)` - Send video to model
141
+ - `await reactor.unpublish_track()` - Stop sending video
142
+ - `reactor.get_status()` - Get current status
143
+ - `reactor.get_session_id()` - Get session ID
144
+ - `reactor.set_frame_callback(callback)` - Set frame callback
145
+
146
+ #### Decorators
147
+
148
+ Use decorators for clean event handling:
149
+
150
+ ```python
151
+ @reactor.on_frame
152
+ def handle_frame(frame):
153
+ """Called for each video frame (numpy array H,W,3)."""
154
+ pass
155
+
156
+ @reactor.on_message
157
+ def handle_message(message):
158
+ """Called for each message from the model."""
159
+ pass
160
+
161
+ @reactor.on_status
162
+ def handle_any_status(status):
163
+ """Called for all status changes."""
164
+ pass
165
+
166
+ @reactor.on_status(ReactorStatus.READY)
167
+ def handle_ready(status):
168
+ """Called only when status becomes READY."""
169
+ pass
170
+
171
+ @reactor.on_status([ReactorStatus.READY, ReactorStatus.CONNECTING])
172
+ def handle_active(status):
173
+ """Called when status is READY or CONNECTING."""
174
+ pass
175
+
176
+ @reactor.on_error
177
+ def handle_error(error):
178
+ """Called when an error occurs."""
179
+ pass
180
+
181
+ @reactor.on_stream
182
+ def handle_stream(track):
183
+ """Called when video stream/track changes."""
184
+ pass
185
+ ```
186
+
187
+ #### Events (alternative to decorators)
188
+
189
+ - `status_changed` - Status changed (disconnected, connecting, ready)
190
+ - `session_id_changed` - Session ID changed
191
+ - `new_message` - Message received from model
192
+ - `stream_changed` - Video stream changed
193
+ - `error` - Error occurred
194
+
195
+ ## Examples
196
+
197
+ See the `examples/` directory for complete examples:
198
+
199
+ - `pygame_app/` - Pygame application with dynamic UI controls
200
+ - `rtmp_app/` - Stream Reactor video to RTMP servers (Twitch, YouTube, etc.)
201
+
202
+ ## License
203
+
204
+ MIT License - Copyright (c) 2025 Reactor Technologies, Inc.
@@ -0,0 +1,17 @@
1
+ reactor_sdk/__init__.py,sha256=ArlbpKS9m9Lnk_qPzQCKr9cLnbo2QafhqbtVZvPhSM4,1141
2
+ reactor_sdk/interface.py,sha256=KZepoLJgIpw5DUUud-fgSf_37NwIRVLBwaH3zECMEWI,6356
3
+ reactor_sdk/py.typed,sha256=SHDQjboaDzPjXhn4h87KOQ0MfRZ2aE-z-5GO9p6eUsY,67
4
+ reactor_sdk/reactor.py,sha256=YWlj6LtWQ8AqJEkRQmcXGyXB85pwoGpAfMMXeRKj8TA,25346
5
+ reactor_sdk/types.py,sha256=Z1rryNF8d4OlXpCgB9qWQSCUBRzZq6bkJ_b7uvEInfc,6486
6
+ reactor_sdk/coordinator/__init__.py,sha256=J4rU6pLpaK2F9B8WwJ5Bq1vZuA4GDtTs00x94dWv6Xs,331
7
+ reactor_sdk/coordinator/client.py,sha256=_W5yWL_hpq6NyKeMj-1LtE-oZBhTerg1OQbdvbsMAzw,12210
8
+ reactor_sdk/coordinator/local_client.py,sha256=X0VFp4msC25Zvp_zYnp7R1UWxE_qovSxcmkUx7Kc7GU,4986
9
+ reactor_sdk/model/__init__.py,sha256=t9UUR34tfLEk_YvF7rZ2EGY0gL5I0JxnYUZP_khkrgk,200
10
+ reactor_sdk/model/client.py,sha256=g0Ep_krVpYXaQV6yVQ7w2vDw2gpq3dNdxff9F8tpc-A,21907
11
+ reactor_sdk/utils/__init__.py,sha256=bFoJC1xKWp0yJtFpe3m92713peW-hkY0lAFVk6TOGog,579
12
+ reactor_sdk/utils/tokens.py,sha256=12ruVwM-G6IHB6E0wtwyP5l_SR5J1oR15-QHrcQfYMQ,1722
13
+ reactor_sdk/utils/webrtc.py,sha256=8VOFy2z7yEJzv7qbY6032qECmxs5VeFbC1LYLVunEvo,8268
14
+ reactor_sdk-0.1.0.dist-info/METADATA,sha256=Y20MW84oa0BoGTK2MtPLWVVkqhsHES7I-DbmLPf2uQI,5828
15
+ reactor_sdk-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
+ reactor_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=CkDoTv8jJieKzduDY7CaXPOki4G_w6Y6FispatCeSeE,1083
17
+ reactor_sdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Reactor Technologies, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.