Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: 嵌套插件名称作用域优化 #2665

Merged
merged 3 commits into from
Apr 20, 2024
Merged

Conversation

yanyongyu
Copy link
Member

Breaking

本 PR 更新了嵌套插件识别逻辑,根据插件的模块路径来判断是否为嵌套插件,例如:parent.plugins.sub_pluginparent 的子插件。

另本 PR 更新了嵌套插件名称作用域,使得不同插件的子插件可以具有相同名称,例如:parent.plugins.sub_plugin 的 插件 ID 为 parent:sub_plugin。插件 ID 将以 : 分割作用域。

Breaking 影响的代码:(如果未使用嵌套插件则无任何影响)

  • 现在使用 nonebot.get_plugin 时,应使用新版作用域 ID,即:nonebot.get_plugin("parent:sub_plugin")
  • 现在使用 require 时,如果原先使用插件名称(非模块路径)调用,现在应使用新版作用域 ID,即 require("parent:sub_plugin")

Related

fix #2597
fix #2536

@yanyongyu yanyongyu added enhancement New feature or request Breaking Breaking change labels Apr 19, 2024
@yanyongyu yanyongyu requested a review from he0119 April 19, 2024 10:04
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 96.84211% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 94.19%. Comparing base (e15d544) to head (bbf48af).

Files Patch % Lines
nonebot/plugin/__init__.py 90.62% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2665      +/-   ##
==========================================
- Coverage   94.21%   94.19%   -0.02%     
==========================================
  Files          48       48              
  Lines        4026     4050      +24     
==========================================
+ Hits         3793     3815      +22     
- Misses        233      235       +2     
Flag Coverage Δ
unittests 94.19% <96.84%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

🚀 Deployed on https://deploy-preview-2665--nonebot2.netlify.app

@github-actions github-actions bot temporarily deployed to pull request April 19, 2024 10:07 Inactive
@yanyongyu yanyongyu merged commit 6bf10aa into master Apr 20, 2024
37 checks passed
@yanyongyu yanyongyu deleted the feat/nested_plugin_id branch April 20, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Breaking change enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Bug: 某些情况下require包有概率出现报错 Feature: 支持重名子插件
2 participants