ErisPulse 2.3.3__tar.gz → 2.3.3.dev0__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 (211) hide show
  1. erispulse-2.3.3.dev0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  2. erispulse-2.3.3.dev0/.github/ISSUE_TEMPLATE/module_submission.md +38 -0
  3. erispulse-2.3.3.dev0/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  4. erispulse-2.3.3.dev0/.github/assets/docs/install_pip.gif +0 -0
  5. erispulse-2.3.3.dev0/.github/assets/erispulse_logo.png +0 -0
  6. erispulse-2.3.3.dev0/.github/scripts/update_packages.py +125 -0
  7. erispulse-2.3.3.dev0/.github/tools/merge_md.py +522 -0
  8. erispulse-2.3.3.dev0/.github/tools/update-api-docs.py +557 -0
  9. erispulse-2.3.3.dev0/.github/workflows/auto-tag-release.yml +95 -0
  10. erispulse-2.3.3.dev0/.github/workflows/auto-update-docs.yml +152 -0
  11. erispulse-2.3.3.dev0/.github/workflows/auto-update-packages.yml +84 -0
  12. erispulse-2.3.3.dev0/.github/workflows/code-quality-check.yml +86 -0
  13. erispulse-2.3.3.dev0/.github/workflows/pypi-publish.yml +91 -0
  14. erispulse-2.3.3.dev0/.python-version +1 -0
  15. erispulse-2.3.3.dev0/CHANGELOG.md +689 -0
  16. erispulse-2.3.3.dev0/CODE_OF_CONDUCT.md +54 -0
  17. erispulse-2.3.3.dev0/CONTRIBUTING.md +62 -0
  18. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/PKG-INFO +1 -1
  19. erispulse-2.3.3.dev0/SECURITY.md +25 -0
  20. erispulse-2.3.3.dev0/devs/test.py +396 -0
  21. erispulse-2.3.3.dev0/devs/test_adapter.py +225 -0
  22. erispulse-2.3.3.dev0/devs/test_cmd.py +419 -0
  23. erispulse-2.3.3.dev0/devs/test_event.py +100 -0
  24. erispulse-2.3.3.dev0/devs/test_event_wrapper.py +181 -0
  25. erispulse-2.3.3.dev0/devs/test_files/test.docx +0 -0
  26. erispulse-2.3.3.dev0/devs/test_files/test.jpg +0 -0
  27. erispulse-2.3.3.dev0/devs/test_files/test.mp4 +0 -0
  28. erispulse-2.3.3.dev0/docs/README.md +49 -0
  29. erispulse-2.3.3.dev0/docs/ai/AIDocs/ErisPulse-AdapterDev.md +8397 -0
  30. erispulse-2.3.3.dev0/docs/ai/AIDocs/ErisPulse-Core.md +7650 -0
  31. erispulse-2.3.3.dev0/docs/ai/AIDocs/ErisPulse-Full.md +9321 -0
  32. erispulse-2.3.3.dev0/docs/ai/AIDocs/ErisPulse-ModuleDev.md +3737 -0
  33. erispulse-2.3.3.dev0/docs/ai/AIDocs/no-api/ErisPulse-AdapterDev.md +3823 -0
  34. erispulse-2.3.3.dev0/docs/ai/AIDocs/no-api/ErisPulse-Core.md +3076 -0
  35. erispulse-2.3.3.dev0/docs/ai/AIDocs/no-api/ErisPulse-Full.md +4747 -0
  36. erispulse-2.3.3.dev0/docs/ai/AIDocs/no-api/ErisPulse-ModuleDev.md +3737 -0
  37. erispulse-2.3.3.dev0/docs/ai/README.md +25 -0
  38. erispulse-2.3.3.dev0/docs/ai/module-generation.md +65 -0
  39. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Bases/__init__.md +14 -0
  40. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Bases/adapter.md +151 -0
  41. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Bases/module.md +65 -0
  42. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/__init__.md +38 -0
  43. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/base.md +95 -0
  44. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/command.md +194 -0
  45. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/exceptions.md +45 -0
  46. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/message.md +122 -0
  47. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/meta.md +121 -0
  48. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/notice.md +141 -0
  49. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/request.md +101 -0
  50. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/Event/wrapper.md +511 -0
  51. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/_self_config.md +82 -0
  52. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/adapter.md +285 -0
  53. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/config.md +90 -0
  54. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/exceptions.md +76 -0
  55. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/lifecycle.md +108 -0
  56. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/logger.md +166 -0
  57. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/module.md +239 -0
  58. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/router.md +142 -0
  59. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/storage.md +356 -0
  60. erispulse-2.3.3.dev0/docs/api/ErisPulse/Core/ux.md +110 -0
  61. erispulse-2.3.3.dev0/docs/api/ErisPulse/__init__.md +423 -0
  62. erispulse-2.3.3.dev0/docs/api/ErisPulse/__main__.md +28 -0
  63. erispulse-2.3.3.dev0/docs/api/ErisPulse/utils/__init__.md +14 -0
  64. erispulse-2.3.3.dev0/docs/api/ErisPulse/utils/cli.md +176 -0
  65. erispulse-2.3.3.dev0/docs/api/ErisPulse/utils/console.md +23 -0
  66. erispulse-2.3.3.dev0/docs/api/ErisPulse/utils/package_manager.md +261 -0
  67. erispulse-2.3.3.dev0/docs/api/ErisPulse/utils/reload_handler.md +75 -0
  68. erispulse-2.3.3.dev0/docs/api/README.md +164 -0
  69. erispulse-2.3.3.dev0/docs/core/README.md +22 -0
  70. erispulse-2.3.3.dev0/docs/core/adapters.md +107 -0
  71. erispulse-2.3.3.dev0/docs/core/best-practices.md +326 -0
  72. erispulse-2.3.3.dev0/docs/core/cli.md +78 -0
  73. erispulse-2.3.3.dev0/docs/core/concepts.md +38 -0
  74. erispulse-2.3.3.dev0/docs/core/event-system.md +597 -0
  75. erispulse-2.3.3.dev0/docs/core/lazy-loading.md +261 -0
  76. erispulse-2.3.3.dev0/docs/core/modules.md +659 -0
  77. erispulse-2.3.3.dev0/docs/core/router.md +535 -0
  78. erispulse-2.3.3.dev0/docs/core/self-config.md +188 -0
  79. erispulse-2.3.3.dev0/docs/development/README.md +44 -0
  80. erispulse-2.3.3.dev0/docs/development/adapter.md +454 -0
  81. erispulse-2.3.3.dev0/docs/development/cli.md +88 -0
  82. erispulse-2.3.3.dev0/docs/development/module.md +701 -0
  83. erispulse-2.3.3.dev0/docs/platform-features/README.md +220 -0
  84. erispulse-2.3.3.dev0/docs/platform-features/email.md +138 -0
  85. erispulse-2.3.3.dev0/docs/platform-features/maintain-notes.md +144 -0
  86. erispulse-2.3.3.dev0/docs/platform-features/onebot11.md +261 -0
  87. erispulse-2.3.3.dev0/docs/platform-features/onebot12.md +339 -0
  88. erispulse-2.3.3.dev0/docs/platform-features/telegram.md +139 -0
  89. erispulse-2.3.3.dev0/docs/platform-features/yunhu.md +153 -0
  90. erispulse-2.3.3.dev0/docs/quick-start.md +149 -0
  91. erispulse-2.3.3.dev0/docs/standards/README.md +19 -0
  92. erispulse-2.3.3.dev0/docs/standards/api-response.md +109 -0
  93. erispulse-2.3.3.dev0/docs/standards/event-conversion.md +194 -0
  94. erispulse-2.3.3.dev0/docs/styleguide/README.md +5 -0
  95. erispulse-2.3.3.dev0/docs/styleguide/docstring_spec.md +95 -0
  96. erispulse-2.3.3.dev0/examples/example-adapter/LICENSE +21 -0
  97. erispulse-2.3.3.dev0/examples/example-adapter/MyAdapter/Converter.py +38 -0
  98. erispulse-2.3.3.dev0/examples/example-adapter/MyAdapter/Core.py +141 -0
  99. erispulse-2.3.3.dev0/examples/example-adapter/MyAdapter/__init__.py +7 -0
  100. erispulse-2.3.3.dev0/examples/example-adapter/README.md +0 -0
  101. erispulse-2.3.3.dev0/examples/example-adapter/pyproject.toml +17 -0
  102. erispulse-2.3.3.dev0/examples/example-cli-module/LICENSE +21 -0
  103. erispulse-2.3.3.dev0/examples/example-cli-module/README.md +0 -0
  104. erispulse-2.3.3.dev0/examples/example-cli-module/my_cli_module/__init__.py +1 -0
  105. erispulse-2.3.3.dev0/examples/example-cli-module/my_cli_module/cli.py +61 -0
  106. erispulse-2.3.3.dev0/examples/example-cli-module/pyproject.toml +18 -0
  107. erispulse-2.3.3.dev0/examples/example-module/LICENSE +21 -0
  108. erispulse-2.3.3.dev0/examples/example-module/MyModule/Core.py +177 -0
  109. erispulse-2.3.3.dev0/examples/example-module/MyModule/__init__.py +1 -0
  110. erispulse-2.3.3.dev0/examples/example-module/README.md +29 -0
  111. erispulse-2.3.3.dev0/examples/example-module/pyproject.toml +17 -0
  112. erispulse-2.3.3.dev0/packages.json +258 -0
  113. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/pyproject.toml +1 -13
  114. erispulse-2.3.3.dev0/scripts/install/install.ps1 +339 -0
  115. erispulse-2.3.3.dev0/scripts/install/install.sh +271 -0
  116. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Bases/adapter.py +1 -13
  117. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/__init__.py +8 -16
  118. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/lifecycle.py +1 -6
  119. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/__init__.py +5 -10
  120. erispulse-2.3.3/src/ErisPulse/Core/Bases/__init__.pyi +0 -14
  121. erispulse-2.3.3/src/ErisPulse/Core/Bases/adapter.pyi +0 -140
  122. erispulse-2.3.3/src/ErisPulse/Core/Bases/module.pyi +0 -52
  123. erispulse-2.3.3/src/ErisPulse/Core/Event/__init__.pyi +0 -26
  124. erispulse-2.3.3/src/ErisPulse/Core/Event/base.pyi +0 -62
  125. erispulse-2.3.3/src/ErisPulse/Core/Event/command.pyi +0 -113
  126. erispulse-2.3.3/src/ErisPulse/Core/Event/exceptions.pyi +0 -43
  127. erispulse-2.3.3/src/ErisPulse/Core/Event/message.pyi +0 -93
  128. erispulse-2.3.3/src/ErisPulse/Core/Event/meta.pyi +0 -92
  129. erispulse-2.3.3/src/ErisPulse/Core/Event/notice.pyi +0 -108
  130. erispulse-2.3.3/src/ErisPulse/Core/Event/request.pyi +0 -76
  131. erispulse-2.3.3/src/ErisPulse/Core/Event/wrapper.pyi +0 -404
  132. erispulse-2.3.3/src/ErisPulse/Core/__init__.pyi +0 -17
  133. erispulse-2.3.3/src/ErisPulse/Core/_self_config.pyi +0 -72
  134. erispulse-2.3.3/src/ErisPulse/Core/adapter.pyi +0 -229
  135. erispulse-2.3.3/src/ErisPulse/Core/config.pyi +0 -70
  136. erispulse-2.3.3/src/ErisPulse/Core/exceptions.pyi +0 -60
  137. erispulse-2.3.3/src/ErisPulse/Core/lifecycle.pyi +0 -92
  138. erispulse-2.3.3/src/ErisPulse/Core/logger.pyi +0 -168
  139. erispulse-2.3.3/src/ErisPulse/Core/module.pyi +0 -178
  140. erispulse-2.3.3/src/ErisPulse/Core/router.pyi +0 -120
  141. erispulse-2.3.3/src/ErisPulse/Core/storage.pyi +0 -273
  142. erispulse-2.3.3/src/ErisPulse/Core/ux.pyi +0 -94
  143. erispulse-2.3.3/src/ErisPulse/__init__.pyi +0 -310
  144. erispulse-2.3.3/src/ErisPulse/__main__.pyi +0 -24
  145. erispulse-2.3.3/src/ErisPulse/sdk_protocol.py +0 -150
  146. erispulse-2.3.3/src/ErisPulse/sdk_protocol.pyi +0 -100
  147. erispulse-2.3.3/src/ErisPulse/utils/__init__.pyi +0 -16
  148. erispulse-2.3.3/src/ErisPulse/utils/cli.pyi +0 -145
  149. erispulse-2.3.3/src/ErisPulse/utils/console.pyi +0 -20
  150. erispulse-2.3.3/src/ErisPulse/utils/package_manager.pyi +0 -224
  151. erispulse-2.3.3/src/ErisPulse/utils/reload_handler.pyi +0 -64
  152. erispulse-2.3.3/stubs/ErisPulse/Core/Bases/__init__.pyi +0 -14
  153. erispulse-2.3.3/stubs/ErisPulse/Core/Bases/adapter.pyi +0 -140
  154. erispulse-2.3.3/stubs/ErisPulse/Core/Bases/module.pyi +0 -52
  155. erispulse-2.3.3/stubs/ErisPulse/Core/Event/__init__.pyi +0 -26
  156. erispulse-2.3.3/stubs/ErisPulse/Core/Event/base.pyi +0 -62
  157. erispulse-2.3.3/stubs/ErisPulse/Core/Event/command.pyi +0 -113
  158. erispulse-2.3.3/stubs/ErisPulse/Core/Event/exceptions.pyi +0 -43
  159. erispulse-2.3.3/stubs/ErisPulse/Core/Event/message.pyi +0 -93
  160. erispulse-2.3.3/stubs/ErisPulse/Core/Event/meta.pyi +0 -92
  161. erispulse-2.3.3/stubs/ErisPulse/Core/Event/notice.pyi +0 -108
  162. erispulse-2.3.3/stubs/ErisPulse/Core/Event/request.pyi +0 -76
  163. erispulse-2.3.3/stubs/ErisPulse/Core/Event/wrapper.pyi +0 -404
  164. erispulse-2.3.3/stubs/ErisPulse/Core/__init__.pyi +0 -17
  165. erispulse-2.3.3/stubs/ErisPulse/Core/_self_config.pyi +0 -72
  166. erispulse-2.3.3/stubs/ErisPulse/Core/adapter.pyi +0 -229
  167. erispulse-2.3.3/stubs/ErisPulse/Core/config.pyi +0 -70
  168. erispulse-2.3.3/stubs/ErisPulse/Core/exceptions.pyi +0 -60
  169. erispulse-2.3.3/stubs/ErisPulse/Core/lifecycle.pyi +0 -92
  170. erispulse-2.3.3/stubs/ErisPulse/Core/logger.pyi +0 -168
  171. erispulse-2.3.3/stubs/ErisPulse/Core/module.pyi +0 -178
  172. erispulse-2.3.3/stubs/ErisPulse/Core/router.pyi +0 -120
  173. erispulse-2.3.3/stubs/ErisPulse/Core/storage.pyi +0 -273
  174. erispulse-2.3.3/stubs/ErisPulse/Core/ux.pyi +0 -94
  175. erispulse-2.3.3/stubs/ErisPulse/__init__.pyi +0 -310
  176. erispulse-2.3.3/stubs/ErisPulse/__main__.pyi +0 -24
  177. erispulse-2.3.3/stubs/ErisPulse/sdk_protocol.pyi +0 -100
  178. erispulse-2.3.3/stubs/ErisPulse/utils/__init__.pyi +0 -16
  179. erispulse-2.3.3/stubs/ErisPulse/utils/cli.pyi +0 -145
  180. erispulse-2.3.3/stubs/ErisPulse/utils/console.pyi +0 -20
  181. erispulse-2.3.3/stubs/ErisPulse/utils/package_manager.pyi +0 -224
  182. erispulse-2.3.3/stubs/ErisPulse/utils/reload_handler.pyi +0 -64
  183. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/.gitignore +0 -0
  184. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/LICENSE +0 -0
  185. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/README.md +0 -0
  186. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Bases/__init__.py +0 -0
  187. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Bases/module.py +0 -0
  188. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/__init__.py +0 -0
  189. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/base.py +0 -0
  190. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/command.py +0 -0
  191. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/exceptions.py +0 -0
  192. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/message.py +0 -0
  193. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/meta.py +0 -0
  194. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/notice.py +0 -0
  195. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/request.py +0 -0
  196. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/Event/wrapper.py +0 -0
  197. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/_self_config.py +0 -0
  198. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/adapter.py +0 -0
  199. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/config.py +0 -0
  200. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/exceptions.py +0 -0
  201. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/logger.py +0 -0
  202. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/module.py +0 -0
  203. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/router.py +0 -0
  204. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/storage.py +0 -0
  205. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/Core/ux.py +0 -0
  206. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/__main__.py +0 -0
  207. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/utils/__init__.py +0 -0
  208. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/utils/cli.py +0 -0
  209. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/utils/console.py +0 -0
  210. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/utils/package_manager.py +0 -0
  211. {erispulse-2.3.3 → erispulse-2.3.3.dev0}/src/ErisPulse/utils/reload_handler.py +0 -0
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: ErisPulse 官方文档
4
+ url: https://erisdev.com/
5
+ about: 查看官方文档获取更多信息
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: 模块/适配器/CLI扩展提交
3
+ about: 提交一个新的模块、适配器或CLI扩展到 ErisPulse 生态系统
4
+ title: '[提交] '
5
+ labels: 'submission'
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## 提交类型
11
+ <!-- 请在适用的选项前打勾 -->
12
+ - [ ] 模块 (Module)
13
+ - [ ] 适配器 (Adapter)
14
+ - [ ] CLI 扩展 (CLI Extension)
15
+
16
+ ## 基本信息
17
+ - **名称**:
18
+ - **描述**:
19
+ - **作者**:
20
+ - **仓库地址**:
21
+
22
+ ## 技术信息
23
+ - **最低 SDK 版本要求** (如适用):
24
+ - **依赖项** (如适用):
25
+
26
+ ## 其他信息
27
+ - [ ] 官方维护
28
+ - **标签** (用逗号分隔):
29
+
30
+ ## 检查清单
31
+ <!-- 请确认以下事项 -->
32
+ - [ ] 代码遵循 ErisPulse 开发规范
33
+ - [ ] 包含适当的文档
34
+ - [ ] 包含测试用例(如适用)
35
+ - [ ] 已在 PyPI 发布(如适用)
36
+
37
+ ## 备注
38
+ <!-- 其他需要说明的信息 -->
@@ -0,0 +1,22 @@
1
+ ## 提交类型
2
+ <!-- 请在适用的选项前打勾 -->
3
+ - [ ] 功能新增
4
+ - [ ] Bug 修复
5
+ - [ ] 文档更新
6
+ - [ ] 代码优化
7
+ - [ ] 其他
8
+
9
+ ## 变更描述
10
+ <!-- 请详细描述本次提交的内容 -->
11
+
12
+ ## 相关 Issue
13
+ <!-- 如果有相关的 Issue,请填写链接 -->
14
+
15
+ ## 检查清单
16
+ - [ ] 代码符合项目规范
17
+ - [ ] 已进行充分测试
18
+ - [ ] 文档已更新(如适用)
19
+ - [ ] CHANGELOG 已更新(如适用)
20
+
21
+ ## 其他说明
22
+ <!-- 其他需要说明的信息 -->
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ 🌟 艾莉丝的版本探知魔法阵 ~
6
+ 这是一个用于自动检测和更新 packages.json 中模块版本的魔法脚本
7
+ """
8
+
9
+ import json
10
+ import requests
11
+ import os
12
+ from datetime import datetime, timezone
13
+ import re
14
+
15
+ # 魔法咒语准备
16
+ headers = {
17
+ 'Authorization': f'token {os.environ["GITHUB_TOKEN"]}',
18
+ 'Accept': 'application/vnd.github.v3+json'
19
+ }
20
+
21
+ def get_latest_pypi_version(package_name):
22
+ try:
23
+ print(f"正在探查 {package_name} 的 PyPI 版本...")
24
+ response = requests.get(f'https://pypi.org/pypi/{package_name}/json', timeout=10)
25
+ if response.status_code == 200:
26
+ data = response.json()
27
+ version = data['info']['version']
28
+ print(f"找到了 {package_name} 的最新版本: {version}")
29
+ return version
30
+ except Exception as e:
31
+ print(f"💢 探查 {package_name} 的 PyPI 版本时遇到了障碍: {e}")
32
+ return None
33
+
34
+ def get_latest_github_release(repo_url):
35
+ try:
36
+ print(f"正在探查 {repo_url} 的 GitHub 发布版本...")
37
+ if 'github.com' in repo_url:
38
+ # 从仓库 URL 提取 owner/repo
39
+ parts = repo_url.rstrip('/').split('/')
40
+ owner_repo = f"{parts[-2]}/{parts[-1]}"
41
+
42
+ response = requests.get(f'https://api.github.com/repos/{owner_repo}/releases/latest', headers=headers, timeout=10)
43
+ if response.status_code == 200:
44
+ data = response.json()
45
+ version = data['tag_name'].lstrip('v') # 移除可能的 'v' 前缀
46
+ print(f"✨ 找到了 {owner_repo} 的最新发布版本: {version}")
47
+ return version
48
+ except Exception as e:
49
+ print(f"💢 探查 {repo_url} 的 GitHub 版本时遇到了障碍: {e}")
50
+ return None
51
+
52
+ def is_version_newer(new_version, old_version):
53
+ try:
54
+ def version_to_tuple(v):
55
+ # 移除版本字符串中的非数字和点字符(如 dev, alpha, beta 等)
56
+ v = re.sub(r'[^\d.]', '', v)
57
+ return tuple(map(int, (v.split('.'))))
58
+
59
+ return version_to_tuple(new_version) > version_to_tuple(old_version)
60
+ except Exception:
61
+ # 如果无法解析,保守地认为需要更新
62
+ return new_version != old_version
63
+
64
+ def update_packages():
65
+ print("🌟 艾莉丝的版本探知魔法阵启动!")
66
+
67
+ # 读取当前的魔法书
68
+ try:
69
+ with open('packages.json', 'r', encoding='utf-8') as f:
70
+ packages = json.load(f)
71
+ print("成功打开了 packages.json 魔法书!")
72
+ except Exception as e:
73
+ print(f"无法打开 packages.json 魔法书: {e}")
74
+ return
75
+
76
+ current_time = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
77
+ packages['last_updated'] = current_time
78
+ print(f"更新时间戳: {current_time}")
79
+
80
+ updated_count = 0
81
+
82
+ for category in ['modules', 'adapters', 'cli_extensions']:
83
+ if category in packages:
84
+ print(f"开始探查 {category} 分类...")
85
+ for name, info in packages[category].items():
86
+ try:
87
+ old_version = info.get('version', '0.0.0')
88
+ print(f"检查 {name} (当前版本: {old_version})")
89
+
90
+ # 尝试从 PyPI 获取最新版本
91
+ new_version = None
92
+ if 'package' in info:
93
+ new_version = get_latest_pypi_version(info.get('package', ''))
94
+
95
+ # 如果 PyPI 获取失败,尝试从 GitHub 获取
96
+ if not new_version and 'repository' in info:
97
+ new_version = get_latest_github_release(info['repository'])
98
+
99
+ # 如果找到了新版本且版本更高,则更新
100
+ if new_version and is_version_newer(new_version, old_version):
101
+ packages[category][name]['version'] = new_version
102
+ print(f"更新 {name}: {old_version} -> {new_version}")
103
+ updated_count += 1
104
+ else:
105
+ print(f"✨ {name} 已经是最新版本啦~")
106
+
107
+ except Exception as e:
108
+ print(f"处理 {name} 时遇到了意外: {e}")
109
+
110
+ # 写回魔法书
111
+ try:
112
+ with open('packages.json', 'w', encoding='utf-8') as f:
113
+ json.dump(packages, f, ensure_ascii=False, indent=4)
114
+ print(f"魔法书更新完成! 共更新了 {updated_count} 个模块~")
115
+ except Exception as e:
116
+ print(f"无法保存魔法书: {e}")
117
+ return
118
+
119
+ if updated_count > 0:
120
+ print("艾莉丝的版本探知魔法大成功!")
121
+ else:
122
+ print("今天没有发现需要更新的模块呢~")
123
+
124
+ if __name__ == '__main__':
125
+ update_packages()