-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Feature or enhancement
The zlib
module has two attributes that denote the zlib library version:
zlib.ZLIB_VERSION
is the version string of the zlib library that was used for building the module. It was add in cb91404 (Python 1.5).zlib.ZLIB_RUNTIME_VERSION
is the version string of the zlib library actually loaded by the interpreter. It was added in bpo-12306/zlib: Expose zlibVersion to query runtime version of zlib #56515 (Python 3.1).
But the version string is not comfortable to use. You need to convert it to a sequence of numbers for comparison, this is boring and errorprone. It would be better to provide a structural version, like sys.version_info
.
Other compression modules do not provide versions at all. The bzlib library has function BZ2_bzlibVersion()
which returns the version string. The lzma version has a number of constants and functions (LZMA_VERSION_STRING
, LZMA_VERSION
, lzma_version_string()
, lzma_version_number()
) which return static and runtime versions as a string or packed into a number.
#115989 by @ivq initially included addition of lzma.LZMA_VERSION
and lzma.LZMA_RUNTIME_VERSION
for version strings (clearly inspired by zlib
). @gpshead renamed them to lzma.LZMA_HEADER_VERSION_STRING
and lzma.LZMA_VERSION_STRING
and added lzma.LZMA_HEADER_VERSION
and lzma.LZMA_VERSION
for versions packed into a number.
I propose to add attributes for version strings and version named tuples for all compression modules. I think that named tuples are more useful than packed numbers. I created a patch for this, but I am not sure about names. Should we use "RUNTIME_" or "HEADER_" prefixes? Should we add "_STRING" or "_info" suffix? Do we need the version of the library that was used for building the module or the version of the library actually loaded by the interpreter is enough?
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status