ErisPulse 2.1.13rc2__py3-none-any.whl → 2.1.14__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 2.1.13rc2
3
+ Version: 2.1.14
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>, runoneall <runoobsteve@gmail.com>
6
6
  License: MIT License
@@ -68,17 +68,26 @@ Description-Content-Type: text/markdown
68
68
  [![FramerOrg](https://img.shields.io/badge/合作伙伴-FramerOrg-blue?style=flat-square)](https://github.com/FramerOrg)
69
69
  [![Python Versions](https://img.shields.io/pypi/pyversions/ErisPulse?style=flat-square)](https://pypi.org/project/ErisPulse/)
70
70
 
71
- > 文档站:
72
- [![Docs-Main](https://img.shields.io/badge/docs-main_site-blue?style=flat-square)](https://www.erisdev.com/docs.html)
73
- [![Docs-CF Pages](https://img.shields.io/badge/docs-cloudflare-blue?style=flat-square)](https://erispulse.pages.dev/docs.html)
74
- [![Docs-GitHub](https://img.shields.io/badge/docs-github-blue?style=flat-square)](https://erispulse.github.io/docs.html)
75
- [![Docs-Netlify](https://img.shields.io/badge/docs-netlify-blue?style=flat-square)](https://erispulse.netlify.app/docs.htm)
71
+ ## 文档站
76
72
 
73
+ [![Docs-Main](https://img.shields.io/badge/docs-main_site-blue?style=flat-square)](https://www.erisdev.com/#docs)
74
+ [![Docs-CF Pages](https://img.shields.io/badge/docs-cloudflare-blue?style=flat-square)](https://erispulse.pages.dev/#docs)
75
+ [![Docs-GitHub](https://img.shields.io/badge/docs-github-blue?style=flat-square)](https://erispulse.github.io/#docs)
76
+ [![Docs-Netlify](https://img.shields.io/badge/docs-netlify-blue?style=flat-square)](https://erispulse.netlify.app/#docs)
77
+
78
+ ## 模块市场
79
+
80
+ [![Market-Main](https://img.shields.io/badge/market-erisdev-blue?style=flat-square)](https://www.erisdev.com/#market)
81
+ [![Market-CF Pages](https://img.shields.io/badge/market-cloudflare-blue?style=flat-square)](https://erispulse.pages.dev/#market)
82
+ [![Market-GitHub](https://img.shields.io/badge/market-github-blue?style=flat-square)](https://erispulse.github.io/#market)
83
+ [![Market-Netlify](https://img.shields.io/badge/market-netlify-blue?style=flat-square)](https://erispulse.netlify.app/#market)
84
+
85
+ ---
77
86
 
78
87
  ## 核心特性
79
88
 
80
89
  | 特性 | 描述 |
81
- |------|------|
90
+ |:-----|:-----|
82
91
  | **异步架构** | 完全基于 async/await 的异步设计 |
83
92
  | **模块化系统** | 灵活的插件和模块管理 |
84
93
  | **热重载** | 开发时自动重载,无需重启 |
@@ -100,6 +109,7 @@ irm https://get.erisdev.com/install.ps1 -OutFile install.ps1; powershell -Execut
100
109
  ```
101
110
 
102
111
  #### macOS/Linux:
112
+
103
113
  ```bash
104
114
  curl -sSL https://get.erisdev.com/install.sh | tee install.sh >/dev/null && chmod +x install.sh && ./install.sh
105
115
  ```
@@ -108,14 +118,14 @@ curl -sSL https://get.erisdev.com/install.sh | tee install.sh >/dev/null && chmo
108
118
 
109
119
  ## 测试与开发
110
120
 
111
- ### 克隆项目并进入目录
121
+ ### 1. 克隆项目并进入目录
112
122
 
113
123
  ```bash
114
124
  git clone -b Develop/v2 https://github.com/ErisPulse/ErisPulse.git
115
125
  cd ErisPulse
116
126
  ```
117
127
 
118
- ### 使用 `uv` 同步项目环境
128
+ ### 2. 使用 `uv` 同步项目环境
119
129
 
120
130
  ```bash
121
131
  uv sync
@@ -127,15 +137,15 @@ source .venv/bin/activate
127
137
 
128
138
  > `ErisPulse` 目前正在使用 `python3.13` 进行开发(所以您同步环境时会自动安装 `3.13`),但也可以使用其他版本(版本不应低于 `3.10`)。
129
139
 
130
- ### 安装依赖并开始
140
+ ### 3. 安装依赖并开始
131
141
 
132
142
  ```bash
133
143
  uv pip install -e .
134
144
  ```
135
145
 
136
- 这将以“开发模式”安装 SDK,所有本地修改都会立即生效。
146
+ 这将以"开发模式"安装 SDK,所有本地修改都会立即生效。
137
147
 
138
- ### 验证安装
148
+ ### 4. 验证安装
139
149
 
140
150
  运行以下命令确认 SDK 正常加载:
141
151
 
@@ -143,7 +153,7 @@ uv pip install -e .
143
153
  python -c "from ErisPulse import sdk; sdk.init()"
144
154
  ```
145
155
 
146
- ### 运行测试
156
+ ### 5. 运行测试
147
157
 
148
158
  我们提供了一个交互式测试脚本,可以帮助您快速验证SDK功能:
149
159
 
@@ -158,14 +168,15 @@ uv run devs/test.py
158
168
  - 工具函数测试
159
169
  - 适配器功能测试
160
170
 
161
- ### 开发模式 (热重载)
171
+ ### 6. 开发模式 (热重载)
172
+
162
173
  ```bash
163
174
  epsdk run your_script.py --reload
164
175
  ```
165
176
 
166
177
  ---
167
178
 
168
- ## 🤝 贡献指南
179
+ ## 贡献指南
169
180
 
170
181
  我们欢迎各种形式的贡献,包括但不限于:
171
182
 
@@ -181,6 +192,10 @@ epsdk run your_script.py --reload
181
192
  4. **文档改进**
182
193
  帮助完善文档和示例代码
183
194
 
195
+ [加入社区讨论 →](https://github.com/ErisPulse/ErisPulse/discussions)
196
+
184
197
  ---
185
198
 
186
- [加入社区讨论 →](https://github.com/ErisPulse/ErisPulse/discussions)
199
+ [![](https://starchart.cc/ErisPulse/ErisPulse.svg?variant=adaptive)](https://starchart.cc/ErisPulse/ErisPulse)
200
+
201
+
@@ -0,0 +1,16 @@
1
+ ErisPulse/__init__.py,sha256=PfRuqOSlKcneLN1KrqcW5wFsgnVmpzrDOWrYYweUBjM,26423
2
+ ErisPulse/__main__.py,sha256=sWlvqyvt3LGrkp7WBSsOSbuPrujqgJvLzt5nA5Bdf4w,40790
3
+ ErisPulse/Core/__init__.py,sha256=hX2yEt9VSD3JubiofoQdcY4v1lnQUU02dhuVADkMTVo,437
4
+ ErisPulse/Core/adapter.py,sha256=oBJOp6SS8sm8NgIxQwetGsHu24wHNXz7ESQ5yKJSo7Q,18234
5
+ ErisPulse/Core/config.py,sha256=2BRWINOqKtHSCP4KfhuiRpGwR96jWGKV7gjZSi_VQHE,2397
6
+ ErisPulse/Core/env.py,sha256=U45f9WtriVyd3tW1N8to-ZvpzcF9gD8DJzNTC1jY2cM,17665
7
+ ErisPulse/Core/erispulse_config.py,sha256=QDx401hNX9JcSHqCSVK33X6VTubl6HI1znAK3T_J0K0,3034
8
+ ErisPulse/Core/exceptions.py,sha256=zuTREGczwGzbYT4Z6dACqHwgNRpiJeLFR8aCxFdOg7k,3667
9
+ ErisPulse/Core/logger.py,sha256=8hdbF6x3JpsQbbeEjvbSej134q5oV0wafagpWq3Nbeg,11223
10
+ ErisPulse/Core/mods.py,sha256=2yIq8t9Ca9CBPRiZU0yr8Lc0XGmmkB7LlH-5FWqXjw4,7023
11
+ ErisPulse/Core/router.py,sha256=66hT8VC2dVNX-dANldoOPDcqQ94hidFkNnvKgAPemGQ,8491
12
+ erispulse-2.1.14.dist-info/METADATA,sha256=_vPGvuW0ovuDT71VdSXESB73bvagY1rpskOrPaGY964,6888
13
+ erispulse-2.1.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ erispulse-2.1.14.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
15
+ erispulse-2.1.14.dist-info/licenses/LICENSE,sha256=4jyqikiB0G0n06CEEMMTzTXjE4IShghSlB74skMSPQs,1464
16
+ erispulse-2.1.14.dist-info/RECORD,,
ErisPulse/Core/raiserr.py DELETED
@@ -1,181 +0,0 @@
1
- """
2
- ErisPulse 错误管理系统
3
-
4
- 提供全局异常捕获功能。不再推荐使用自定义错误注册功能。
5
-
6
- {!--< tips >!--}
7
- 1. 请使用Python原生异常抛出方法
8
- 2. 系统会自动捕获并格式化所有未处理异常
9
- 3. 注册功能已标记为弃用,将在未来版本移除
10
- {!--< /tips >!--}
11
- """
12
-
13
- import sys
14
- import traceback
15
- import asyncio
16
- from typing import Dict, Any, Optional, Type, Callable, List, Set, Tuple, Union
17
-
18
- class Error:
19
- """
20
- 错误管理器
21
-
22
- {!--< deprecated >!--} 请使用Python原生异常抛出方法 | 2025-07-18
23
-
24
- {!--< tips >!--}
25
- 1. 注册功能将在未来版本移除
26
- 2. 请直接使用raise Exception("message")方式抛出异常
27
- {!--< /tips >!--}
28
- """
29
-
30
- def __init__(self):
31
- self._types = {}
32
-
33
- def register(self, name: str, doc: str = "", base: Type[Exception] = Exception) -> Type[Exception]:
34
- """
35
- 注册新的错误类型
36
-
37
- {!--< deprecated >!--} 请使用Python原生异常抛出方法 | 2025-07-18
38
-
39
- :param name: 错误类型名称
40
- :param doc: 错误描述文档
41
- :param base: 基础异常类
42
- :return: 注册的错误类
43
- """
44
- if name not in self._types:
45
- err_cls = type(name, (base,), {"__doc__": doc})
46
- self._types[name] = err_cls
47
- return self._types[name]
48
-
49
- def __getattr__(self, name: str) -> Callable[..., None]:
50
- """
51
- 动态获取错误抛出函数
52
-
53
- {!--< deprecated >!--} 请使用Python原生异常抛出方法 | 2025-07-18
54
-
55
- :param name: 错误类型名称
56
- :return: 错误抛出函数
57
-
58
- :raises AttributeError: 当错误类型未注册时抛出
59
- """
60
- def raiser(msg: str, exit: bool = False) -> None:
61
- """
62
- 错误抛出函数
63
-
64
- :param msg: 错误消息
65
- :param exit: 是否退出程序
66
- """
67
- from .logger import logger
68
- err_cls = self._types.get(name) or self.register(name)
69
- exc = err_cls(msg)
70
-
71
- red = '\033[91m'
72
- reset = '\033[0m'
73
-
74
- logger.error(f"{red}{name}: {msg} | {err_cls.__doc__}{reset}")
75
- logger.error(f"{red}{ ''.join(traceback.format_stack()) }{reset}")
76
-
77
- if exit:
78
- raise exc
79
- return raiser
80
-
81
- def info(self, name: Optional[str] = None) -> Dict[str, Any]:
82
- """
83
- 获取错误信息
84
-
85
- {!--< deprecated >!--} 此功能将在未来版本移除 | 2025-07-18
86
-
87
- :param name: 错误类型名称(可选)
88
- :return: 错误信息字典
89
- """
90
- result = {}
91
- for err_name, err_cls in self._types.items():
92
- result[err_name] = {
93
- "type": err_name,
94
- "doc": getattr(err_cls, "__doc__", ""),
95
- "class": err_cls,
96
- }
97
- if name is None:
98
- return result
99
- err_cls = self._types.get(name)
100
- if not err_cls:
101
- return {
102
- "type": None,
103
- "doc": None,
104
- "class": None,
105
- }
106
- return {
107
- "type": name,
108
- "doc": getattr(err_cls, "__doc__", ""),
109
- "class": err_cls,
110
- }
111
-
112
-
113
- raiserr = Error()
114
-
115
- def global_exception_handler(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any) -> None:
116
- """
117
- 全局异常处理器
118
-
119
- :param exc_type: 异常类型
120
- :param exc_value: 异常值
121
- :param exc_traceback: 追踪信息
122
- """
123
- RED = '\033[91m'
124
- YELLOW = '\033[93m'
125
- BLUE = '\033[94m'
126
- RESET = '\033[0m'
127
-
128
- error_title = f"{RED}{exc_type.__name__}{RESET}: {YELLOW}{exc_value}{RESET}"
129
- traceback_lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
130
-
131
- colored_traceback = []
132
- for line in traceback_lines:
133
- if "File " in line and ", line " in line:
134
- parts = line.split(', line ')
135
- colored_line = f"{BLUE}{parts[0]}{RESET}, line {parts[1]}"
136
- colored_traceback.append(colored_line)
137
- else:
138
- colored_traceback.append(f"{RED}{line}{RESET}")
139
-
140
- full_error = f"""
141
- {error_title}
142
- {RED}Traceback:{RESET}
143
- {colored_traceback}"""
144
-
145
- sys.stderr.write(full_error)
146
-
147
- def async_exception_handler(loop: asyncio.AbstractEventLoop, context: Dict[str, Any]) -> None:
148
- """
149
- 异步异常处理器
150
-
151
- :param loop: 事件循环
152
- :param context: 上下文字典
153
- """
154
- RED = '\033[91m'
155
- YELLOW = '\033[93m'
156
- BLUE = '\033[94m'
157
- RESET = '\033[0m'
158
-
159
- exception = context.get('exception')
160
- if exception:
161
- tb = ''.join(traceback.format_exception(type(exception), exception, exception.__traceback__))
162
-
163
- colored_tb = []
164
- for line in tb.split('\n'):
165
- if "File " in line and ", line " in line:
166
- parts = line.split(', line ')
167
- colored_line = f"{BLUE}{parts[0]}{RESET}, line {parts[1]}"
168
- colored_tb.append(colored_line)
169
- else:
170
- colored_tb.append(f"{RED}{line}{RESET}")
171
-
172
- error_msg = f"""{RED}{type(exception).__name__}{RESET}: {YELLOW}{exception}{RESET}
173
- {RED}Traceback:{RESET}
174
- {colored_tb}"""
175
- sys.stderr.write(error_msg)
176
- else:
177
- msg = context.get('message', 'Unknown async error')
178
- sys.stderr.write(f"{RED}Async Error{RESET}: {YELLOW}{msg}{RESET}")
179
-
180
- sys.excepthook = global_exception_handler
181
- asyncio.get_event_loop().set_exception_handler(async_exception_handler)
ErisPulse/Core/util.py DELETED
@@ -1,123 +0,0 @@
1
- """
2
- ErisPulse 工具函数集合
3
-
4
- 提供常用工具函数,包括拓扑排序、缓存装饰器、异步执行等实用功能。
5
-
6
- {!--< tips >!--}
7
- 1. 使用@cache装饰器缓存函数结果
8
- 2. 使用@run_in_executor在独立线程中运行同步函数
9
- 3. 使用@retry实现自动重试机制
10
- {!--< /tips >!--}
11
- """
12
-
13
- import time
14
- import asyncio
15
- import functools
16
- import traceback
17
- from concurrent.futures import ThreadPoolExecutor
18
- from collections import defaultdict, deque
19
- from typing import List, Dict, Type, Callable, Any, Optional, Set
20
-
21
- executor = ThreadPoolExecutor()
22
-
23
- class Util:
24
- """
25
- 工具函数集合
26
-
27
- 提供各种实用功能,简化开发流程
28
-
29
- {!--< tips >!--}
30
- 1. 拓扑排序用于解决依赖关系
31
- 2. 装饰器简化常见模式实现
32
- 3. 异步执行提升性能
33
- {!--< /tips >!--}
34
- """
35
- def ExecAsync(self, async_func: Callable, *args: Any, **kwargs: Any) -> Any:
36
- """
37
- 异步执行函数
38
-
39
- :param async_func: 异步函数
40
- :param args: 位置参数
41
- :param kwargs: 关键字参数
42
- :return: 函数执行结果
43
-
44
- :example:
45
- >>> result = util.ExecAsync(my_async_func, arg1, arg2)
46
- """
47
- loop = asyncio.get_event_loop()
48
- return loop.run_in_executor(executor, lambda: asyncio.run(async_func(*args, **kwargs)))
49
-
50
- def cache(self, func: Callable) -> Callable:
51
- """
52
- 缓存装饰器
53
-
54
- :param func: 被装饰函数
55
- :return: 装饰后的函数
56
-
57
- :example:
58
- >>> @util.cache
59
- >>> def expensive_operation(param):
60
- >>> return heavy_computation(param)
61
- """
62
- cache_dict = {}
63
- @functools.wraps(func)
64
- def wrapper(*args, **kwargs):
65
- key = (args, tuple(sorted(kwargs.items())))
66
- if key not in cache_dict:
67
- cache_dict[key] = func(*args, **kwargs)
68
- return cache_dict[key]
69
- return wrapper
70
-
71
- def run_in_executor(self, func: Callable) -> Callable:
72
- """
73
- 在独立线程中执行同步函数的装饰器
74
-
75
- :param func: 被装饰的同步函数
76
- :return: 可等待的协程函数
77
-
78
- :example:
79
- >>> @util.run_in_executor
80
- >>> def blocking_io():
81
- >>> # 执行阻塞IO操作
82
- >>> return result
83
- """
84
- @functools.wraps(func)
85
- async def wrapper(*args, **kwargs):
86
- loop = asyncio.get_event_loop()
87
- try:
88
- return await loop.run_in_executor(None, lambda: func(*args, **kwargs))
89
- except Exception as e:
90
- from . import logger
91
- logger.error(f"线程内发生未处理异常:\n{''.join(traceback.format_exc())}")
92
- return wrapper
93
-
94
- def retry(self, max_attempts: int = 3, delay: int = 1) -> Callable:
95
- """
96
- 自动重试装饰器
97
-
98
- :param max_attempts: 最大重试次数 (默认: 3)
99
- :param delay: 重试间隔(秒) (默认: 1)
100
- :return: 装饰器函数
101
-
102
- :example:
103
- >>> @util.retry(max_attempts=5, delay=2)
104
- >>> def unreliable_operation():
105
- >>> # 可能失败的操作
106
- """
107
- def decorator(func: Callable) -> Callable:
108
- @functools.wraps(func)
109
- def wrapper(*args, **kwargs):
110
- attempts = 0
111
- while attempts < max_attempts:
112
- try:
113
- return func(*args, **kwargs)
114
- except Exception as e:
115
- attempts += 1
116
- if attempts == max_attempts:
117
- raise
118
- time.sleep(delay)
119
- return wrapper
120
- return decorator
121
-
122
-
123
- util = Util()
@@ -1,16 +0,0 @@
1
- ErisPulse/__init__.py,sha256=T-N56UQyBmpvlqwH2wGi5ptPzaJpbgF5tKkJt0DlkaM,26099
2
- ErisPulse/__main__.py,sha256=gizHkbu70K8wFhYE_3sWUyiZpaL1imuwQHHQ93XVbrQ,35773
3
- ErisPulse/Core/__init__.py,sha256=tBYPahQ7-w7U6M69xy8DW0_ECa9ja-Q0y_SQqVswYBo,409
4
- ErisPulse/Core/adapter.py,sha256=ZK81dibJ471FowL0MRXkS113iBcMgj_VzpTw0PzhAEo,18102
5
- ErisPulse/Core/config.py,sha256=ZmwGdtHSOE7K5uOGzLYcyl3ZF3sAmeWAntqcdfDzhpM,5027
6
- ErisPulse/Core/env.py,sha256=HGkzsdbxh8c1GSDJhnGP9B09Sz2ZeNbRxWieaFmAcug,18870
7
- ErisPulse/Core/logger.py,sha256=cJzNXF-EmdWxwgiHg5Itmkwsva2Jhe9l9X4rXKiXHgc,8296
8
- ErisPulse/Core/mods.py,sha256=2yIq8t9Ca9CBPRiZU0yr8Lc0XGmmkB7LlH-5FWqXjw4,7023
9
- ErisPulse/Core/raiserr.py,sha256=vlyaaiOIYkyqm9dAqSW9E54JBzX-9roHDp5_r6I0yUU,5591
10
- ErisPulse/Core/server.py,sha256=FkDTeLuHD5IBnWVxvYU8pHb6yCt8GzyvC1bpOiJ7G7I,9217
11
- ErisPulse/Core/util.py,sha256=7rdMmn6sBFqYd4znxBCcJjuv2eyTExdeKyZopgds868,3796
12
- erispulse-2.1.13rc2.dist-info/METADATA,sha256=XTCluJfTY1p3SYwCkN7Ji2-K8VysXzAgqM10hBlYar4,6262
13
- erispulse-2.1.13rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- erispulse-2.1.13rc2.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
15
- erispulse-2.1.13rc2.dist-info/licenses/LICENSE,sha256=4jyqikiB0G0n06CEEMMTzTXjE4IShghSlB74skMSPQs,1464
16
- erispulse-2.1.13rc2.dist-info/RECORD,,