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