python / python/cpython

Add structured version info for modules wrapping external libraries

Đang mở
#157,472 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

3.16 extension-modules type-feature
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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_version is not exposed).
  • dbm.ndbm — only library (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, only major.minor, e.g. '8.6'), and tkinter.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 as Tcl().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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách đọc gh-117404 và so sánh mẫu API phiên bản của zlib, bz2, lzma và compression.zstd trong đó với danh sách module trong issue này. Xem xét các sub-issue liên quan và xác định module nào có thể cung cấp thông tin phiên bản nhất quán tại thời điểm build và runtime; được coi là hoàn tất khi mỗi module được chọn có một giao diện public đã được thống nhất mà không phá vỡ các tên hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
backend
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.