Skip to content

Don't fail on import when cramjam lacks a codec - #998

Merged
martindurant merged 3 commits into
dask:mainfrom
itzzdev09:import-without-cramjam-gzip
Nov 25, 2026
Merged

martindurant merged 3 commits into
dask:mainfrom
itzzdev09:import-without-cramjam-gzip

Conversation

@itzzdev09

Copy link
Copy Markdown

Fixes #984.

Debian builds cramjam without some of its codecs (gzip, in the report), and import fastparquet then fails in compression.py with AttributeError: module 'cramjam' has no attribute 'gzip', because every codec was registered unconditionally.

Now each cramjam codec (gzip, snappy, brotli, lz4, zstd) is only registered in compressions, decompressions and decom_into when cramjam provides it. Everything else keeps working, and asking for a codec that isn't there fails when it is used with the existing Compression 'gzip' not available. Options: [...] message. I did not change the default compression.

I ran it against the released fastparquet 2026.9.0 (the installed compression.py is identical to main) with cramjam.gzip deleted to mimic the Debian build: the original module fails to import with the error above; with this change the import works, snappy/zstd/brotli/lz4/uncompressed round trips succeed, and compression="gzip" raises the "not available" error. Added test_import_without_cramjam_gzip, which fails without the change. fastparquet/test/test_compression.py: 12 passed, 1 skipped (Windows, Python 3.12); I did not run the rest of the test suite.

@martindurant
martindurant merged commit 3181950 into dask:main Nov 25, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

import fails when cramjam is built without gzip support

2 participants