PCTEJA opened a new pull request, #4498: URL: https://github.com/apache/iceberg-python/pull/4498
# Rationale for this change Refs #4495 (first follow-up item only; the cp315 wheel smoke test and the Python 3.15 CI items are not covered here). PEP 784 makes `compression.zstd` optional: it is only built when libzstd is available. On a Python 3.14+ build without it, the import in `pyiceberg/avro/codecs/zstandard_codec.py` raises at module load, and because `pyiceberg/avro/codecs/__init__.py` imports `ZStandardCodec` eagerly, reading any manifest breaks. `pyiceberg/table/puffin.py` has the same flaw when the `zstandard` package is missing. With the `python_version < '3.14'` marker on the `zstandard` dependency, users also cannot recover through the dependency itself. This adds a shared `pyiceberg/utils/zstd.py` module that tries `compression.zstd` first, then the `zstandard` package, and only raises `ImportError` on use when neither is available. The Avro codec and Puffin both go through it. The `zstandard` backend decompresses frame by frame and checks each frame is complete, so truncated or concatenated frames behave as before. The install hint now points at `pip install zstandard`, since there is no `pyiceberg[zstandard]` extra. ## Are these changes tested? Yes. New tests in `tests/table/test_puffin.py` cover the roundtrip, raising only on use when no backend is available, a fresh interpreter import with both `zstandard` and `compression.zstd` blocked (imports of `pyiceberg.manifest`, the codec and Puffin succeed), and truncated and concatenated frames. `tests/table/test_puffin.py`, `tests/avro/` and `tests/utils/test_manifest.py`: 243 passed, run twice with the same result. The new no-backend test fails on base. ## Are there any user-facing changes? No API changes. Manifest and Puffin reads no longer fail at import time on Python builds without stdlib `compression.zstd`; zstd-compressed data raises `ImportError` only when it is actually read and no backend is installed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
