From 4355025f87a511a1d31969dba2022ea8a32efbd2 Mon Sep 17 00:00:00 2001 From: Akirami <66513481+A-kirami@users.noreply.github.com> Date: Sat, 12 Nov 2022 18:22:16 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Feature:=20=E4=BD=BF=E7=94=A8=20`i?= =?UTF-8?q?mportlib.metadata`=20=E6=9B=BF=E6=8D=A2=20`pkg=5Fresources`=20(?= =?UTF-8?q?#1388)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: yanyongyu <42488585+yanyongyu@users.noreply.github.com> --- nonebot/__init__.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nonebot/__init__.py b/nonebot/__init__.py index 52b6ac07..31bc9063 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -39,6 +39,7 @@ FrontMatter: import os import importlib +from importlib.metadata import version from typing import Any, Dict, Type, Optional import loguru @@ -51,14 +52,9 @@ from nonebot.config import Env, Config from nonebot.drivers import Driver, ReverseDriver, combine_driver try: - import pkg_resources - - _dist: pkg_resources.Distribution = pkg_resources.get_distribution("nonebot2") - __version__ = _dist.version - VERSION = _dist.parsed_version + __version__ = version("nonebot2") except Exception: # pragma: no cover __version__ = None - VERSION = None _driver: Optional[Driver] = None