Add structured version info for modules wrapping external libraries
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Feature or enhancement
Several modules wrap an external library, but expose its version inconsistently: only a string, only a plain tuple, only the runtime or only the build-time version, or under a private name. gh-117404 established a pattern for zlib, bz2, lzma and compression.zstd: a string and a named tuple for the version the module was built against (XXX_VERSION, XXX_VERSION_INFO), and the same pair for the library actually loaded (xxx_version, xxx_version_info).
Other modules (existing names, with their types):
sqlite3— runtime:sqlite_version(str),sqlite_version_info(plain tuple, computed in Python from the string). No build-time version.pyexpat— runtime:EXPAT_VERSION(str, e.g.'expat_2.8.4'),version_info(plain tuple). No build-time version.decimal— runtime:__libmpdec_version__(str). No tuple, no build-time version. Matters more now that only the system libmpdec is used.readline— build-time:_READLINE_VERSION(int,0x0803). Runtime:_READLINE_RUNTIME_VERSION(int),_READLINE_LIBRARY_VERSION(str). All private;backend(str) tells readline from libedit.dbm.gnu— build-time: private_GDBM_VERSION(plain tuple). No runtime version (gdbm_versionis not exposed).dbm.ndbm— onlylibrary(str, the implementation name). No version.ctypes— nothing about libffi.uuid— nothing about libuuid.ssl— runtime:OPENSSL_VERSION(str),OPENSSL_VERSION_INFO(plain 5-tuple),OPENSSL_VERSION_NUMBER(int). Build-time: only private_OPENSSL_API_VERSION(plain 5-tuple). The existing names conflict with the scheme above (uppercase names for the runtime version).curses— runtime:ncurses_version(named tuple). No string, no build-time version. It is fine to keep only the named tuple.tkinter— build-time:_tkinter.TCL_VERSION,TK_VERSION(str, onlymajor.minor, e.g.'8.6'), andtkinter.TclVersion,TkVersion(float,8.6, derived from them). The runtime version cannot be obtained at import time without creating a Tcl interpreter; it is available asTcl().eval('info patchlevel').
Not all items need to be changed, and not all libraries provide both the compile-time and the runtime version. Sub-issues are opened for those that do.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 gh-117404,并将其中 zlib、bz2、lzma 和 compression.zstd 的版本 API 模式与本 issue 中的模块清单进行比较。审查相关的 sub-issue,并确定哪些模块可以公开一致的构建时和运行时版本信息;当每个选定模块都有一个达成一致的公共接口且不破坏现有名称时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100