rune-framework 1.1.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chasey
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.
@@ -0,0 +1,3 @@
1
+ recursive-include src/rune/_proto *.py
2
+ include LICENSE
3
+ include README.md
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: rune-framework
3
+ Version: 1.1.1
4
+ Summary: Official Python SDK for Rune — protocol-first multi-language function execution framework
5
+ Author: Chasey
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/chasey-dev/rune
8
+ Project-URL: Repository, https://github.com/chasey-dev/rune
9
+ Project-URL: Documentation, https://github.com/chasey-dev/rune/tree/main/sdks/python
10
+ Keywords: rune,grpc,distributed,function,execution,framework
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: grpcio>=1.60.0
22
+ Requires-Dist: protobuf>=4.25.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: grpcio-tools>=1.60.0; extra == "dev"
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
27
+ Requires-Dist: httpx>=0.27; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # Rune Python SDK
31
+
32
+ Official Python Caster SDK for the Rune framework.
33
+
34
+ ## 安装
35
+
36
+ ```bash
37
+ pip install rune-framework
38
+ ```
39
+
40
+ 要求 Python >= 3.10。
41
+
42
+ ## 快速开始
43
+
44
+ ```python
45
+ from rune import Caster
46
+
47
+ caster = Caster("localhost:50070")
48
+
49
+ @caster.rune("echo", gate="/echo")
50
+ async def echo(ctx, input):
51
+ return input
52
+
53
+ caster.run()
54
+ ```
55
+
56
+ 启动后 Runtime 自动暴露:
57
+ ```
58
+ POST /echo -- sync
59
+ POST /echo?stream=true -- SSE streaming
60
+ POST /echo?async=true -- async task
61
+ ```
62
+
63
+ ## Caster 配置
64
+
65
+ ```python
66
+ caster = Caster(
67
+ addr="localhost:50070", # Runtime gRPC 地址
68
+ caster_id="my-python-caster", # Caster ID(默认 "python-caster")
69
+ max_concurrent=10, # 最大并发处理数
70
+ labels={"env": "prod", "gpu": "true"}, # Caster 标签(用于标签路由)
71
+ api_key="rk_xxx", # API Key(认证开启时需要)
72
+ reconnect_base_delay=1.0, # 重连初始延迟(秒)
73
+ reconnect_max_delay=30.0, # 重连最大延迟(秒)
74
+ heartbeat_interval=10.0, # 心跳间隔(秒)
75
+ )
76
+ ```
77
+
78
+ ## 注册 Rune
79
+
80
+ ### Unary Handler
81
+
82
+ ```python
83
+ @caster.rune(
84
+ "translate",
85
+ gate="/translate", # HTTP 路由路径
86
+ gate_method="POST", # HTTP 方法(默认 POST)
87
+ version="1.0.0", # 语义版本
88
+ description="Translate text", # 人类可读描述
89
+ priority=10, # 优先级(越高越优先)
90
+ input_schema={ # JSON Schema 输入校验
91
+ "type": "object",
92
+ "properties": {
93
+ "text": {"type": "string"},
94
+ "lang": {"type": "string"}
95
+ },
96
+ "required": ["text", "lang"]
97
+ },
98
+ output_schema={ # JSON Schema 输出校验
99
+ "type": "object",
100
+ "properties": {
101
+ "translated": {"type": "string"}
102
+ }
103
+ },
104
+ )
105
+ async def translate(ctx, input):
106
+ data = json.loads(input)
107
+ result = do_translate(data["text"], data["lang"])
108
+ return json.dumps({"translated": result})
109
+ ```
110
+
111
+ ### Streaming Handler
112
+
113
+ ```python
114
+ @caster.stream_rune("generate", gate="/generate")
115
+ async def generate(ctx, input, sender):
116
+ prompt = json.loads(input)["prompt"]
117
+ for token in model.stream(prompt):
118
+ await sender.emit(token) # 发送一个 chunk
119
+ # StreamEnd 自动发送
120
+ ```
121
+
122
+ `StreamSender.emit()` 接受 `bytes`、`str`、`dict`、`list` 类型,自动序列化。
123
+
124
+ ### File Handler
125
+
126
+ Handler 的第三个参数命名为 `files` 时,自动接收文件附件:
127
+
128
+ ```python
129
+ @caster.rune("process-doc", gate="/process")
130
+ async def process_doc(ctx, input, files):
131
+ # files: list[FileAttachment]
132
+ for f in files:
133
+ print(f.filename, f.mime_type, len(f.data))
134
+ return json.dumps({"processed": len(files)})
135
+ ```
136
+
137
+ `FileAttachment` 字段:
138
+ - `filename: str` -- 文件名
139
+ - `data: bytes` -- 文件内容
140
+ - `mime_type: str` -- MIME 类型
141
+
142
+ ## Context
143
+
144
+ 每次调用都会传入 `RuneContext`:
145
+
146
+ ```python
147
+ @caster.rune("example", gate="/example")
148
+ async def example(ctx, input):
149
+ print(ctx.rune_name) # "example"
150
+ print(ctx.request_id) # "r-18e8f3a1b-0"
151
+ print(ctx.context) # {} (额外的 key-value 上下文)
152
+ return input
153
+ ```
154
+
155
+ ## 运行与停止
156
+
157
+ ```python
158
+ # 阻塞运行(自动重连)
159
+ caster.run()
160
+
161
+ # 从另一个线程停止
162
+ caster.stop()
163
+ ```
164
+
165
+ ## 开发
166
+
167
+ ```bash
168
+ cd sdks/python
169
+ pip install -e ".[dev]"
170
+ pytest tests/test_unit.py # 单元测试
171
+ pytest tests/test_e2e.py -m e2e # E2E 测试(需要运行中的 Runtime)
172
+ ```
@@ -0,0 +1,143 @@
1
+ # Rune Python SDK
2
+
3
+ Official Python Caster SDK for the Rune framework.
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pip install rune-framework
9
+ ```
10
+
11
+ 要求 Python >= 3.10。
12
+
13
+ ## 快速开始
14
+
15
+ ```python
16
+ from rune import Caster
17
+
18
+ caster = Caster("localhost:50070")
19
+
20
+ @caster.rune("echo", gate="/echo")
21
+ async def echo(ctx, input):
22
+ return input
23
+
24
+ caster.run()
25
+ ```
26
+
27
+ 启动后 Runtime 自动暴露:
28
+ ```
29
+ POST /echo -- sync
30
+ POST /echo?stream=true -- SSE streaming
31
+ POST /echo?async=true -- async task
32
+ ```
33
+
34
+ ## Caster 配置
35
+
36
+ ```python
37
+ caster = Caster(
38
+ addr="localhost:50070", # Runtime gRPC 地址
39
+ caster_id="my-python-caster", # Caster ID(默认 "python-caster")
40
+ max_concurrent=10, # 最大并发处理数
41
+ labels={"env": "prod", "gpu": "true"}, # Caster 标签(用于标签路由)
42
+ api_key="rk_xxx", # API Key(认证开启时需要)
43
+ reconnect_base_delay=1.0, # 重连初始延迟(秒)
44
+ reconnect_max_delay=30.0, # 重连最大延迟(秒)
45
+ heartbeat_interval=10.0, # 心跳间隔(秒)
46
+ )
47
+ ```
48
+
49
+ ## 注册 Rune
50
+
51
+ ### Unary Handler
52
+
53
+ ```python
54
+ @caster.rune(
55
+ "translate",
56
+ gate="/translate", # HTTP 路由路径
57
+ gate_method="POST", # HTTP 方法(默认 POST)
58
+ version="1.0.0", # 语义版本
59
+ description="Translate text", # 人类可读描述
60
+ priority=10, # 优先级(越高越优先)
61
+ input_schema={ # JSON Schema 输入校验
62
+ "type": "object",
63
+ "properties": {
64
+ "text": {"type": "string"},
65
+ "lang": {"type": "string"}
66
+ },
67
+ "required": ["text", "lang"]
68
+ },
69
+ output_schema={ # JSON Schema 输出校验
70
+ "type": "object",
71
+ "properties": {
72
+ "translated": {"type": "string"}
73
+ }
74
+ },
75
+ )
76
+ async def translate(ctx, input):
77
+ data = json.loads(input)
78
+ result = do_translate(data["text"], data["lang"])
79
+ return json.dumps({"translated": result})
80
+ ```
81
+
82
+ ### Streaming Handler
83
+
84
+ ```python
85
+ @caster.stream_rune("generate", gate="/generate")
86
+ async def generate(ctx, input, sender):
87
+ prompt = json.loads(input)["prompt"]
88
+ for token in model.stream(prompt):
89
+ await sender.emit(token) # 发送一个 chunk
90
+ # StreamEnd 自动发送
91
+ ```
92
+
93
+ `StreamSender.emit()` 接受 `bytes`、`str`、`dict`、`list` 类型,自动序列化。
94
+
95
+ ### File Handler
96
+
97
+ Handler 的第三个参数命名为 `files` 时,自动接收文件附件:
98
+
99
+ ```python
100
+ @caster.rune("process-doc", gate="/process")
101
+ async def process_doc(ctx, input, files):
102
+ # files: list[FileAttachment]
103
+ for f in files:
104
+ print(f.filename, f.mime_type, len(f.data))
105
+ return json.dumps({"processed": len(files)})
106
+ ```
107
+
108
+ `FileAttachment` 字段:
109
+ - `filename: str` -- 文件名
110
+ - `data: bytes` -- 文件内容
111
+ - `mime_type: str` -- MIME 类型
112
+
113
+ ## Context
114
+
115
+ 每次调用都会传入 `RuneContext`:
116
+
117
+ ```python
118
+ @caster.rune("example", gate="/example")
119
+ async def example(ctx, input):
120
+ print(ctx.rune_name) # "example"
121
+ print(ctx.request_id) # "r-18e8f3a1b-0"
122
+ print(ctx.context) # {} (额外的 key-value 上下文)
123
+ return input
124
+ ```
125
+
126
+ ## 运行与停止
127
+
128
+ ```python
129
+ # 阻塞运行(自动重连)
130
+ caster.run()
131
+
132
+ # 从另一个线程停止
133
+ caster.stop()
134
+ ```
135
+
136
+ ## 开发
137
+
138
+ ```bash
139
+ cd sdks/python
140
+ pip install -e ".[dev]"
141
+ pytest tests/test_unit.py # 单元测试
142
+ pytest tests/test_e2e.py -m e2e # E2E 测试(需要运行中的 Runtime)
143
+ ```
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rune-framework"
7
+ version = "1.1.1"
8
+ description = "Official Python SDK for Rune — protocol-first multi-language function execution framework"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Chasey"}]
12
+ requires-python = ">=3.10"
13
+ keywords = ["rune", "grpc", "distributed", "function", "execution", "framework"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ ]
23
+ dependencies = [
24
+ "grpcio>=1.60.0",
25
+ "protobuf>=4.25.0",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "grpcio-tools>=1.60.0",
31
+ "pytest>=7.0",
32
+ "pytest-asyncio>=0.23",
33
+ "httpx>=0.27",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/chasey-dev/rune"
38
+ Repository = "https://github.com/chasey-dev/rune"
39
+ Documentation = "https://github.com/chasey-dev/rune/tree/main/sdks/python"
40
+
41
+ [tool.pytest.ini_options]
42
+ asyncio_mode = "auto"
43
+ markers = [
44
+ "e2e: end-to-end tests requiring a running rune-server",
45
+ ]
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+ include = ["rune*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """Rune SDK -- Official Python Caster SDK for the Rune framework."""
2
+
3
+ __version__ = "1.1.1"
4
+
5
+ from .caster import Caster
6
+ from .types import RuneConfig, RuneContext, FileAttachment
7
+ from .stream import StreamSender
@@ -0,0 +1 @@
1
+ """Generated protobuf/gRPC code. Do not edit manually."""
File without changes
@@ -0,0 +1,74 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: rune/wire/v1/rune.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'rune/wire/v1/rune.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17rune/wire/v1/rune.proto\x12\x0crune.wire.v1\"\xc5\x03\n\x0eSessionMessage\x12,\n\x06\x61ttach\x18\n \x01(\x0b\x32\x1a.rune.wire.v1.CasterAttachH\x00\x12,\n\x06\x64\x65tach\x18\x0b \x01(\x0b\x32\x1a.rune.wire.v1.CasterDetachH\x00\x12-\n\x06result\x18\x0c \x01(\x0b\x32\x1b.rune.wire.v1.ExecuteResultH\x00\x12\x31\n\x0cstream_event\x18\r \x01(\x0b\x32\x19.rune.wire.v1.StreamEventH\x00\x12-\n\nstream_end\x18\x0e \x01(\x0b\x32\x17.rune.wire.v1.StreamEndH\x00\x12-\n\nattach_ack\x18\x14 \x01(\x0b\x32\x17.rune.wire.v1.AttachAckH\x00\x12/\n\x07\x65xecute\x18\x15 \x01(\x0b\x32\x1c.rune.wire.v1.ExecuteRequestH\x00\x12-\n\x06\x63\x61ncel\x18\x16 \x01(\x0b\x32\x1b.rune.wire.v1.CancelRequestH\x00\x12,\n\theartbeat\x18\x1e \x01(\x0b\x32\x17.rune.wire.v1.HeartbeatH\x00\x42\t\n\x07payload\"\xdb\x01\n\x0c\x43\x61sterAttach\x12\x11\n\tcaster_id\x18\x01 \x01(\t\x12,\n\x05runes\x18\x02 \x03(\x0b\x32\x1d.rune.wire.v1.RuneDeclaration\x12\x36\n\x06labels\x18\x03 \x03(\x0b\x32&.rune.wire.v1.CasterAttach.LabelsEntry\x12\x16\n\x0emax_concurrent\x18\x04 \x01(\r\x12\x0b\n\x03key\x18\x05 \x01(\t\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"I\n\tAttachAck\x12\x10\n\x08\x61\x63\x63\x65pted\x18\x01 \x01(\x08\x12\x0e\n\x06reason\x18\x02 \x01(\t\x12\x1a\n\x12supported_features\x18\x03 \x03(\t\"\x1e\n\x0c\x43\x61sterDetach\x12\x0e\n\x06reason\x18\x01 \x01(\t\"\xc5\x01\n\x0fRuneDeclaration\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x14\n\x0cinput_schema\x18\x04 \x01(\t\x12\x15\n\routput_schema\x18\x05 \x01(\t\x12\x17\n\x0fsupports_stream\x18\x06 \x01(\x08\x12&\n\x04gate\x18\x07 \x01(\x0b\x32\x18.rune.wire.v1.GateConfig\x12\x10\n\x08priority\x18\x08 \x01(\x05\"*\n\nGateConfig\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0e\n\x06method\x18\x02 \x01(\t\"C\n\x0e\x46ileAttachment\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12\x11\n\tmime_type\x18\x03 \x01(\t\"\xf9\x01\n\x0e\x45xecuteRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x11\n\trune_name\x18\x02 \x01(\t\x12\r\n\x05input\x18\x03 \x01(\x0c\x12:\n\x07\x63ontext\x18\x04 \x03(\x0b\x32).rune.wire.v1.ExecuteRequest.ContextEntry\x12\x12\n\ntimeout_ms\x18\x05 \x01(\r\x12\x31\n\x0b\x61ttachments\x18\x06 \x03(\x0b\x32\x1c.rune.wire.v1.FileAttachment\x1a.\n\x0c\x43ontextEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"3\n\rCancelRequest\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\"\xb6\x01\n\rExecuteResult\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12$\n\x06status\x18\x02 \x01(\x0e\x32\x14.rune.wire.v1.Status\x12\x0e\n\x06output\x18\x03 \x01(\x0c\x12(\n\x05\x65rror\x18\x04 \x01(\x0b\x32\x19.rune.wire.v1.ErrorDetail\x12\x31\n\x0b\x61ttachments\x18\x05 \x03(\x0b\x32\x1c.rune.wire.v1.FileAttachment\"C\n\x0bStreamEvent\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12\x12\n\nevent_type\x18\x03 \x01(\t\"o\n\tStreamEnd\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12$\n\x06status\x18\x02 \x01(\x0e\x32\x14.rune.wire.v1.Status\x12(\n\x05\x65rror\x18\x03 \x01(\x0b\x32\x19.rune.wire.v1.ErrorDetail\"!\n\tHeartbeat\x12\x14\n\x0ctimestamp_ms\x18\x01 \x01(\x04\"=\n\x0b\x45rrorDetail\x12\x0c\n\x04\x63ode\x18\x01 \x01(\t\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65tails\x18\x03 \x01(\x0c*_\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x14\n\x10STATUS_COMPLETED\x10\x01\x12\x11\n\rSTATUS_FAILED\x10\x02\x12\x14\n\x10STATUS_CANCELLED\x10\x03\x32X\n\x0bRuneService\x12I\n\x07Session\x12\x1c.rune.wire.v1.SessionMessage\x1a\x1c.rune.wire.v1.SessionMessage(\x01\x30\x01\x62\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'rune.wire.v1.rune_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ DESCRIPTOR._loaded_options = None
34
+ _globals['_CASTERATTACH_LABELSENTRY']._loaded_options = None
35
+ _globals['_CASTERATTACH_LABELSENTRY']._serialized_options = b'8\001'
36
+ _globals['_EXECUTEREQUEST_CONTEXTENTRY']._loaded_options = None
37
+ _globals['_EXECUTEREQUEST_CONTEXTENTRY']._serialized_options = b'8\001'
38
+ _globals['_STATUS']._serialized_start=1909
39
+ _globals['_STATUS']._serialized_end=2004
40
+ _globals['_SESSIONMESSAGE']._serialized_start=42
41
+ _globals['_SESSIONMESSAGE']._serialized_end=495
42
+ _globals['_CASTERATTACH']._serialized_start=498
43
+ _globals['_CASTERATTACH']._serialized_end=717
44
+ _globals['_CASTERATTACH_LABELSENTRY']._serialized_start=672
45
+ _globals['_CASTERATTACH_LABELSENTRY']._serialized_end=717
46
+ _globals['_ATTACHACK']._serialized_start=719
47
+ _globals['_ATTACHACK']._serialized_end=792
48
+ _globals['_CASTERDETACH']._serialized_start=794
49
+ _globals['_CASTERDETACH']._serialized_end=824
50
+ _globals['_RUNEDECLARATION']._serialized_start=827
51
+ _globals['_RUNEDECLARATION']._serialized_end=1024
52
+ _globals['_GATECONFIG']._serialized_start=1026
53
+ _globals['_GATECONFIG']._serialized_end=1068
54
+ _globals['_FILEATTACHMENT']._serialized_start=1070
55
+ _globals['_FILEATTACHMENT']._serialized_end=1137
56
+ _globals['_EXECUTEREQUEST']._serialized_start=1140
57
+ _globals['_EXECUTEREQUEST']._serialized_end=1389
58
+ _globals['_EXECUTEREQUEST_CONTEXTENTRY']._serialized_start=1343
59
+ _globals['_EXECUTEREQUEST_CONTEXTENTRY']._serialized_end=1389
60
+ _globals['_CANCELREQUEST']._serialized_start=1391
61
+ _globals['_CANCELREQUEST']._serialized_end=1442
62
+ _globals['_EXECUTERESULT']._serialized_start=1445
63
+ _globals['_EXECUTERESULT']._serialized_end=1627
64
+ _globals['_STREAMEVENT']._serialized_start=1629
65
+ _globals['_STREAMEVENT']._serialized_end=1696
66
+ _globals['_STREAMEND']._serialized_start=1698
67
+ _globals['_STREAMEND']._serialized_end=1809
68
+ _globals['_HEARTBEAT']._serialized_start=1811
69
+ _globals['_HEARTBEAT']._serialized_end=1844
70
+ _globals['_ERRORDETAIL']._serialized_start=1846
71
+ _globals['_ERRORDETAIL']._serialized_end=1907
72
+ _globals['_RUNESERVICE']._serialized_start=2006
73
+ _globals['_RUNESERVICE']._serialized_end=2094
74
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,100 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from rune._proto.rune.wire.v1 import rune_pb2 as rune_dot_wire_dot_v1_dot_rune__pb2
7
+
8
+ GRPC_GENERATED_VERSION = '1.78.0'
9
+ GRPC_VERSION = grpc.__version__
10
+ _version_not_supported = False
11
+
12
+ try:
13
+ from grpc._utilities import first_version_is_lower
14
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
15
+ except ImportError:
16
+ _version_not_supported = True
17
+
18
+ if _version_not_supported:
19
+ raise RuntimeError(
20
+ f'The grpc package installed is at version {GRPC_VERSION},'
21
+ + ' but the generated code in rune/wire/v1/rune_pb2_grpc.py depends on'
22
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
23
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
24
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
25
+ )
26
+
27
+
28
+ class RuneServiceStub(object):
29
+ """Caster 与 Runtime 的双向流
30
+ """
31
+
32
+ def __init__(self, channel):
33
+ """Constructor.
34
+
35
+ Args:
36
+ channel: A grpc.Channel.
37
+ """
38
+ self.Session = channel.stream_stream(
39
+ '/rune.wire.v1.RuneService/Session',
40
+ request_serializer=rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.SerializeToString,
41
+ response_deserializer=rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.FromString,
42
+ _registered_method=True)
43
+
44
+
45
+ class RuneServiceServicer(object):
46
+ """Caster 与 Runtime 的双向流
47
+ """
48
+
49
+ def Session(self, request_iterator, context):
50
+ """Missing associated documentation comment in .proto file."""
51
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
52
+ context.set_details('Method not implemented!')
53
+ raise NotImplementedError('Method not implemented!')
54
+
55
+
56
+ def add_RuneServiceServicer_to_server(servicer, server):
57
+ rpc_method_handlers = {
58
+ 'Session': grpc.stream_stream_rpc_method_handler(
59
+ servicer.Session,
60
+ request_deserializer=rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.FromString,
61
+ response_serializer=rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.SerializeToString,
62
+ ),
63
+ }
64
+ generic_handler = grpc.method_handlers_generic_handler(
65
+ 'rune.wire.v1.RuneService', rpc_method_handlers)
66
+ server.add_generic_rpc_handlers((generic_handler,))
67
+ server.add_registered_method_handlers('rune.wire.v1.RuneService', rpc_method_handlers)
68
+
69
+
70
+ # This class is part of an EXPERIMENTAL API.
71
+ class RuneService(object):
72
+ """Caster 与 Runtime 的双向流
73
+ """
74
+
75
+ @staticmethod
76
+ def Session(request_iterator,
77
+ target,
78
+ options=(),
79
+ channel_credentials=None,
80
+ call_credentials=None,
81
+ insecure=False,
82
+ compression=None,
83
+ wait_for_ready=None,
84
+ timeout=None,
85
+ metadata=None):
86
+ return grpc.experimental.stream_stream(
87
+ request_iterator,
88
+ target,
89
+ '/rune.wire.v1.RuneService/Session',
90
+ rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.SerializeToString,
91
+ rune_dot_wire_dot_v1_dot_rune__pb2.SessionMessage.FromString,
92
+ options,
93
+ channel_credentials,
94
+ insecure,
95
+ call_credentials,
96
+ compression,
97
+ wait_for_ready,
98
+ timeout,
99
+ metadata,
100
+ _registered_method=True)