From 95365e42fbaaa1ba70f4b8ffd6653467aec4fd89 Mon Sep 17 00:00:00 2001 From: nishad shabbir Date: Mon, 5 Oct 2026 13:27:20 +0530 Subject: [PATCH 1/2] GH-52024: [Python] Fix the codec list in show_info() show_info() prints its Compression Codecs section from a hardcoded list that has drifted from the names _ensure_compression() actually accepts. "lz4" and "lz4_frame" both map to CCompressionType_LZ4_FRAME, so the same codec was reported twice under two names, while "lz4_raw", which maps to CCompressionType_LZ4 and is a separate codec, was not reported at all. Seven lines were printed for six codecs, and the seventh codec pyarrow supports was missing. List "lz4" once and add "lz4_raw". --- python/pyarrow/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py index f2a874f56fa4..58b7d68188bd 100644 --- a/python/pyarrow/__init__.py +++ b/python/pyarrow/__init__.py @@ -156,7 +156,9 @@ def print_entry(label, value): print(f" {fs: <20}: {status: <8}") print("\nCompression Codecs:") - codecs = ["brotli", "bz2", "gzip", "lz4_frame", "lz4", "snappy", "zstd"] + # "lz4" and "lz4_frame" are the same codec, and lz4_raw is a + # separate one that was missing here. See _ensure_compression(). + codecs = ["brotli", "bz2", "gzip", "lz4", "lz4_raw", "snappy", "zstd"] for codec in codecs: status = "Enabled" if Codec.is_available(codec) else "-" print(f" {codec: <20}: {status: <8}") From a60875d571d09457fefd7fa0974899d5fb85a38a Mon Sep 17 00:00:00 2001 From: nishad shabbir Date: Tue, 13 Oct 2026 18:19:35 +0530 Subject: [PATCH 2/2] Name the codec lz4_frame and cover show_info() with a test Say "lz4_frame" rather than "lz4" so the two lz4 codecs read unambiguously next to each other, and add a test that captures the output. Which codecs and modules are enabled depends on the build, so the test checks the labels and the sections rather than their status. --- python/pyarrow/__init__.py | 7 ++++--- python/pyarrow/tests/test_misc.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py index 58b7d68188bd..c024cdc69a7d 100644 --- a/python/pyarrow/__init__.py +++ b/python/pyarrow/__init__.py @@ -156,9 +156,10 @@ def print_entry(label, value): print(f" {fs: <20}: {status: <8}") print("\nCompression Codecs:") - # "lz4" and "lz4_frame" are the same codec, and lz4_raw is a - # separate one that was missing here. See _ensure_compression(). - codecs = ["brotli", "bz2", "gzip", "lz4", "lz4_raw", "snappy", "zstd"] + # "lz4" is an alias for "lz4_frame", so the list used to name the same + # codec twice and leave out lz4_raw. See _ensure_compression(). + codecs = ["brotli", "bz2", "gzip", "lz4_frame", "lz4_raw", "snappy", + "zstd"] for codec in codecs: status = "Enabled" if Codec.is_available(codec) else "-" print(f" {codec: <20}: {status: <8}") diff --git a/python/pyarrow/tests/test_misc.py b/python/pyarrow/tests/test_misc.py index 856873f441b4..c0fa484e35ea 100644 --- a/python/pyarrow/tests/test_misc.py +++ b/python/pyarrow/tests/test_misc.py @@ -123,6 +123,26 @@ def test_runtime_info(): subprocess.check_call([sys.executable, "-c", code], env=env) +def test_show_info(capsys): + pa.show_info() + out = capsys.readouterr().out + + # Which codecs and modules are enabled depends on how PyArrow was built, + # so only the labels are checked, not their status. + assert "Compression Codecs:" in out + codecs = [line.split(":")[0].strip() + for line in out.split("Compression Codecs:")[1].splitlines() + if ":" in line] + # "lz4" is an alias for "lz4_frame", so naming both listed one codec + # twice and left out lz4_raw. + assert codecs == ["brotli", "bz2", "gzip", "lz4_frame", "lz4_raw", + "snappy", "zstd"] + + for section in ("Platform:", "Memory:", "Optional modules:", + "Filesystems:"): + assert section in out + + @pytest.mark.processes def test_import_at_shutdown(): # GH-38626: importing PyArrow at interpreter shutdown would crash