Skip to content

Commit

Permalink
如果是pydantic v2又没有安装pydantic-settings,提示用户手动安装
Browse files Browse the repository at this point in the history
  • Loading branch information
huangwenlong06 committed Sep 4, 2024
1 parent 21cbf11 commit f363ff5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ nonebug = "^0.3.5"
pytest = "^7.4.3"
pytest-asyncio = "^0.21.1"
pytest-cov = "^4.1.0"
pydantic-settings = "^2.4.0"


[tool.black]
Expand Down
7 changes: 6 additions & 1 deletion src/nonebot_plugin_access_control/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
try:
from pydantic_settings import BaseSettings
except ImportError:
from pydantic import BaseSettings
try:
from pydantic import BaseSettings
except ImportError as e:
raise ImportError(
"如果你正在使用pydantic v2,请手动安装pydantic-settings"
) from e


class Config(BaseSettings):
Expand Down

0 comments on commit f363ff5

Please sign in to comment.