mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:16:48 +08:00
✨ Feature: 使用 importlib.metadata
替换 pkg_resources
(#1388)
Co-authored-by: yanyongyu <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
parent
0bc8a39578
commit
4355025f87
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user