Repository navigation
feat: add zstd request body compression - #1218
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1218 +/- ##
==========================================
- Coverage 95.76% 95.67% -0.09%
==========================================
Files 63 65 +2
Lines 6703 6753 +50
==========================================
+ Hits 6419 6461 +42
- Misses 284 292 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vdusek
left a comment
There was a problem hiding this comment.
Could you add a self-review / staff review to the porting process?
vdusek
left a comment
There was a problem hiding this comment.
Note: compressor_case in tests/unit/test_http_clients.py (outside the diff) still covers only gzip and brotli. Consider adding a zstd case: pytest.param((ZstdHttpCompressor(), 'zstd', zstd.decompress), id='zstd').
✍️ Drafted by Claude Code
Cover a key-value store record and a dataset push through a client that compresses request bodies with zstd, for both transports and both the sync and async client. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ocuAK2fAevKdoyPCB2HvC
# Conflicts: # tests/_utils.py # tests/integration/conftest.py
# Conflicts: # tests/unit/test_http_clients.py
Ports apify/apify-client-js#1200.
compression='zstd'onApifyClient,ApifyClientAsync, andActorServerClient.requestselects the newZstdHttpCompressor(apify_client.http_compressors).qualitygoes from 1 to 19 and defaults to 3, as in JS. Levels 20 to 22 are rejected because their window is larger than the 8 MB that RFC 9659 requires HTTP decoders to support. An invalid quality raisesValueError, like the other Python compressors.compression.zstd. Older versions need the newzstdextra, which installsbackports.zstd.import apify_clientstill works. OnlyZstdHttpCompressorandcompression='zstd'raiseImportError. This covers a missing extra, a Python 3.14+ build without zstd, and an installed backport that can't load.brotlipackage is installed but its C extension can't load,import apify_clientworks and onlyBrotliHttpCompressorandcompression='brotli'raiseImportError.try_importtreats a missing parent package (backports) as a missing dependency. A load error re-raised from another import error gets no install hint, because installing the extra doesn't fix it.backports.zstdis listed inallowed-unresolved-importsfor runs on 3.14+, where it isn't installed.✍️ Drafted by Claude Code