Skip to content

Commit 0961841

Browse files
committed
build: 更新依赖和版本号获取方式
将 flows 依赖从 taolib[flows] 更新为 taolib[dev] 修改版本号获取方式,使用 importlib.metadata 替代直接导入
1 parent dac7bbd commit 0961841

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

doc/conf.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def get_project_root():
2424

2525
ROOT = get_project_root()
2626
sys.path.extend([str(ROOT/'doc')])
27-
from taolib import get_version # 引入获取版本号的函数
2827

2928
# === 注入本地修复版 sphinx_tippy 扩展路径 ===
3029
# 说明:为修复 Wikipedia 抓取告警,优先加载仓库内修复版扩展。
@@ -36,7 +35,11 @@ def get_project_root():
3635
# ================================= 项目基本信息 =================================
3736
project = "torch-book" # 文档项目名称
3837
author = "xinetzone" # 文档作者
39-
release = get_version("torch-book") # 获取torch-book的版本号
38+
try:
39+
from importlib.metadata import version as _pkg_version
40+
release = _pkg_version("taolib")
41+
except Exception:
42+
release = os.environ.get("TAOLIB_VERSION", "0.0.0")
4043
copyright = '2021, xinetzone' # 版权信息
4144
# ================================= 国际化与本地化设置 ==============================
4245
language = 'zh_CN' # 文档语言(中文简体)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ doc = [
4141
]
4242

4343
flows = [
44-
"taolib[flows]",
44+
"taolib[dev]",
4545
]
4646

4747
gui = [

0 commit comments

Comments
 (0)