Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ Release notes
Unreleased
----------

Breaking changes
~~~~~~~~~~~~~~~~
* `Zstd.default_level`, `Zstd.min_level`, and `Zstd.max_level` are now class methods
instead of properties. This means they must now be called like ``Zstd.default_level()``
instead of ``Zstd.default_level``. This breaking change has been made because Python 3.13
removes support for class properties.
By :user:`David Stansby <dstansby>`

Enhancements
~~~~~~~~~~~~

Expand Down
6 changes: 3 additions & 3 deletions numcodecs/tests/test_zstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ def test_checksum():

def test_native_functions():
# Note, these assertions might need to be changed for new versions of zstd
assert Zstd.default_level == 3
assert Zstd.min_level == -131072
assert Zstd.max_level == 22
assert Zstd.default_level() == 3
assert Zstd.min_level() == -131072
assert Zstd.max_level() == 22
9 changes: 3 additions & 6 deletions numcodecs/zstd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ cdef extern from "zstd.h":

ZSTD_CCtx* ZSTD_createCCtx() nogil
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) nogil
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx,
ZSTD_cParameter param,
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx,
ZSTD_cParameter param,
int value) nogil

size_t ZSTD_compress2(ZSTD_CCtx* cctx,
Expand Down Expand Up @@ -235,7 +235,7 @@ class Zstd(Codec):
"""

codec_id = 'zstd'

# Note: unlike the LZ4 and Blosc codecs, there does not appear to be a (currently)
# practical limit on the size of buffers that Zstd can process and so we don't
# enforce a max_buffer_size option here.
Expand All @@ -259,19 +259,16 @@ class Zstd(Codec):
return r

@classmethod
@property
def default_level(cls):
"""Returns the default compression level of the underlying zstd library."""
return ZSTD_defaultCLevel()

@classmethod
@property
def min_level(cls):
"""Returns the minimum compression level of the underlying zstd library."""
return ZSTD_minCLevel()

@classmethod
@property
def max_level(cls):
"""Returns the maximum compression level of the underlying zstd library."""
return ZSTD_maxCLevel()
Loading