Skip to content

Switch from pyzstd to compression.zstd#818

Open
avalentino wants to merge 2 commits intozarr-developers:mainfrom
avalentino:feature/conpression.zsrd
Open

Switch from pyzstd to compression.zstd#818
avalentino wants to merge 2 commits intozarr-developers:mainfrom
avalentino:feature/conpression.zsrd

Conversation

@avalentino
Copy link
Contributor

[Description of PR]

Python v3.14 introduces the compression.zstd module (derived from pyzsrd).
For Python versions lower than v3.14 the backports.zstd module is now available.

This patch modifies teh test code to use compression.zsrd intead of the old and deprecated pyzstd module.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

Python v3.14 introduces the `compression.zstd` module
(derived from pyzsrd).
For Python versions lower than v3.14 the `backports.zstd`
module is now available.

This patch modifies teh test code to use `compression.zsrd`
intead of the old and deprecated `pyzstd` module.
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.33%. Comparing base (eab1742) to head (de276c9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #818   +/-   ##
=======================================
  Coverage   99.33%   99.33%           
=======================================
  Files          26       26           
  Lines         898      898           
=======================================
  Hits          892      892           
  Misses          6        6           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@avalentino
Copy link
Contributor Author

Failures seem to be unrelated to this PR.

@d-v-b
Copy link
Contributor

d-v-b commented Feb 15, 2026

@avalentino are you using zstd in the context of Zarr? because if so, would you mind opening a PR to make this change in zarr-python, which would allow us to no longer depend on numcodecs for zstd in that library?

@d-v-b
Copy link
Contributor

d-v-b commented Feb 15, 2026

the context is, putting codec implementations in a separate library only makes sense when they require special dependencies. If a zstd codec can be implemented in zarr-python directly via simple dependencies (like a backport), then we don't really need numcodecs in the loop for that codec

@avalentino
Copy link
Contributor Author

I didn't look at the code yet but it seems reasonable to me.
I will try

@avalentino
Copy link
Contributor Author

OK, just to be clear
this particular PR acts only on the test code.
pyzstd is currently used to to test the correct implementation of the numcodecs Zstd codec. and for this purpose only it is replaced by compression.zstd form the Python standard library.

Of course it should be possible to have a Zstd Codec based on compression.zstd but it would be a by far larger change.

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