ErisPulse 1.2.0__tar.gz → 1.2.2__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.
- {erispulse-1.2.0 → erispulse-1.2.2}/PKG-INFO +1 -1
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/CHANGELOG.md +6 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/pyproject.toml +1 -1
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/__init__.py +28 -18
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/__main__.py +12 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/assets/erispulse_logo.png +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/config/notify.json +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/tools/merge_md.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/tools/update-api-docs.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/workflows/notifications.yml +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/workflows/pypi-publish.yml +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/workflows/send-email/action.yml +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/workflows/send-email/send_mail.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.github/workflows/send-email/send_mail_old.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.gitignore +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/.python-version +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/LICENSE +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/README.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/devs/test.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/devs/test_adapter.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/devs/test_files/test.docx +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/devs/test_files/test.jpg +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/devs/test_files/test.mp4 +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/ADAPTERS.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/AI-Module-Generation.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/CLI.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/DEVELOPMENT.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/ForAIDocs/ErisPulseDevelop.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/ORIGIN.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/REFERENCE.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/docs/quick-start.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/cd_branch.sh +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/commit.sh +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/create_branch.sh +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/create_pr.sh +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/merge_dev.sh +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/gitc/usage.md +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/adapter.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/db.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/logger.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/mods.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/raiserr.py +0 -0
- {erispulse-1.2.0 → erispulse-1.2.2}/src/ErisPulse/util.py +0 -0
|
@@ -91,9 +91,11 @@ def init_progress():
|
|
|
91
91
|
from pathlib import Path
|
|
92
92
|
env_file = Path("env.py")
|
|
93
93
|
main_file = Path("main.py")
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
env_init = False
|
|
95
|
+
main_init = False
|
|
96
|
+
try:
|
|
97
|
+
if not env_file.exists():
|
|
98
|
+
env_content = '''# env.py
|
|
97
99
|
# ErisPulse 环境配置文件
|
|
98
100
|
# 本文件由 SDK 自动创建,请勿随意删除
|
|
99
101
|
# 配置项可通过 sdk.env.get(key, default) 获取,或使用 sdk.env.set(key, value) 设置
|
|
@@ -111,46 +113,54 @@ def init_progress():
|
|
|
111
113
|
|
|
112
114
|
from ErisPulse import sdk
|
|
113
115
|
'''
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
with open(env_file, "w", encoding="utf-8") as f:
|
|
117
|
+
f.write(env_content)
|
|
118
|
+
env_init = True
|
|
119
|
+
if not main_file.exists():
|
|
120
|
+
main_content = '''# main.py
|
|
116
121
|
# ErisPulse 主程序文件
|
|
117
122
|
# 本文件由 SDK 自动创建,您可随意修改
|
|
118
|
-
|
|
123
|
+
import asyncio
|
|
119
124
|
from ErisPulse import sdk
|
|
120
125
|
|
|
121
126
|
async def main():
|
|
122
127
|
try:
|
|
123
128
|
sdk.init()
|
|
124
129
|
await sdk.adapter.startup()
|
|
125
|
-
|
|
130
|
+
|
|
131
|
+
# 保持程序运行(不建议修改)
|
|
132
|
+
await asyncio.Event().wait()
|
|
126
133
|
except Exception as e:
|
|
127
134
|
sdk.logger.error(e)
|
|
128
135
|
except KeyboardInterrupt:
|
|
129
136
|
sdk.logger.info("正在停止程序")
|
|
130
137
|
finally:
|
|
131
|
-
await sdk.shutdown()
|
|
138
|
+
await sdk.adapter.shutdown()
|
|
132
139
|
|
|
133
140
|
if __name__ == "__main__":
|
|
134
141
|
asyncio.run(main())
|
|
135
142
|
'''
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return False
|
|
144
|
-
return False
|
|
143
|
+
with open(main_file, "w", encoding="utf-8") as f:
|
|
144
|
+
f.write(main_content)
|
|
145
|
+
main_init = True
|
|
146
|
+
return env_init, main_init
|
|
147
|
+
except Exception as e:
|
|
148
|
+
sdk.logger.error(f"无法初始化项目环境: {e}")
|
|
149
|
+
return False
|
|
145
150
|
|
|
146
151
|
def _prepare_environment() -> bool:
|
|
147
152
|
# 检查环境
|
|
148
153
|
logger.info("[Init] 准备初始化环境...")
|
|
149
154
|
try:
|
|
150
|
-
|
|
155
|
+
env_init, main_init = init_progress()
|
|
156
|
+
if env_init:
|
|
151
157
|
logger.info("[Init] 项目首次初始化,建议先配置环境变量")
|
|
152
158
|
if input("是否立即退出?(y/n): ").strip().lower() == "y":
|
|
153
159
|
return False
|
|
160
|
+
if main_init:
|
|
161
|
+
logger.info("[Init] 项目入口已生成, 建议您在 main.py 中编写主程序")
|
|
162
|
+
if input("是否立即退出?(y/n): ").strip().lower() == "y":
|
|
163
|
+
return False
|
|
154
164
|
env.load_env_file()
|
|
155
165
|
return True
|
|
156
166
|
except Exception as e:
|
|
@@ -1040,6 +1040,9 @@ def main():
|
|
|
1040
1040
|
upgrade_parser = subparsers.add_parser('upgrade', help='升级模块列表')
|
|
1041
1041
|
upgrade_parser.add_argument('--force', action='store_true', help='跳过二次确认,强制更新')
|
|
1042
1042
|
|
|
1043
|
+
# 初始化命令
|
|
1044
|
+
init_parser = subparsers.add_parser('init', help='初始化模块数据库')
|
|
1045
|
+
|
|
1043
1046
|
origin_parser = subparsers.add_parser('origin', help='管理模块源')
|
|
1044
1047
|
origin_subparsers = origin_parser.add_subparsers(
|
|
1045
1048
|
dest='origin_command',
|
|
@@ -1219,6 +1222,15 @@ def main():
|
|
|
1219
1222
|
except KeyboardInterrupt:
|
|
1220
1223
|
shellprint.panel("脚本执行已中断", "中断", "info")
|
|
1221
1224
|
|
|
1225
|
+
elif args.command == 'init':
|
|
1226
|
+
print(f"{Shell_Printer.GREEN}正在初始化项目...{Shell_Printer.RESET}")
|
|
1227
|
+
from . import init as init_module
|
|
1228
|
+
try:
|
|
1229
|
+
init_module()
|
|
1230
|
+
print(f"{Shell_Printer.GREEN}项目初始化完成{Shell_Printer.RESET}")
|
|
1231
|
+
except Exception as e:
|
|
1232
|
+
print(f"{Shell_Printer.RED}项目初始化失败: {e}{Shell_Printer.RESET}")
|
|
1233
|
+
|
|
1222
1234
|
elif args.command == 'origin':
|
|
1223
1235
|
if args.origin_command == 'add':
|
|
1224
1236
|
success = source_manager.add_source(args.url)
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|