Skip to content

Conversation

@Rogdham
Copy link

@Rogdham Rogdham commented Oct 19, 2025

Python 3.14 introduces support for Zstandard in the standard library via the compression.zstd module (PEP-784).

This PR removes the zstdandard extra dependency in favor of the native support in Python 3.14+. For older Python versions, the backport is used.

It also has the advantage of supporting free threading.

Related: Test on Python 3.14 #2361

Full disclosure: I'm the author and maintainer of backports.zstd, and the maintainer of pyzstd (which code was used as a base for the integration into Python). I also helped with PEP-784 and its integration into CPython.

@auvipy auvipy added this to the 5.7.0 milestone Oct 19, 2025
@auvipy auvipy requested a review from Copilot October 19, 2025 08:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates from the third-party zstandard package to Python's native compression.zstd module (introduced in Python 3.14 via PEP-784), with backports.zstd as a fallback for older Python versions.

Key Changes:

  • Replaced zstandard==0.25.0 dependency with backports.zstd==1.0.0 for Python < 3.14
  • Updated import logic to use native compression.zstd on Python 3.14+ or backports.zstd otherwise
  • Simplified compression/decompression by using built-in compress/decompress functions instead of wrapper functions

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
requirements/extras/zstd.txt Updated dependency from zstandard to backports.zstd with Python version constraint
kombu/compression.py Changed imports to use native or backport zstd, replaced custom wrapper functions with direct API calls
t/unit/test_compression.py Updated test fixtures to check for zstd availability at module level instead of per-test imports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Rogdham
Copy link
Author

Rogdham commented Oct 19, 2025

t/unit/test_compression.py Updated test fixtures to check for zstd availability at module level instead of per-test imports

I reverted this to fix the lint error I had. Now linting is green!

@auvipy auvipy self-requested a review October 19, 2025 12:36
@cclauss cclauss mentioned this pull request Oct 20, 2025
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.

2 participants