Skip to content

Releases: indygreg/python-zstandard

0.25.0

14 Sep 22:15
Compare
Choose a tag to compare
  • PyO3 Rust created upgraded from 0.24 to 0.25. (#273)
  • We now use Py_REFCNT(obj) instead of accessing (*obj)->ob_refcnt directly.
    This fixes a nogil / multi-threaded compile error. (#201, #275)
  • A zstandard commit to fix qsort detection on BSD operating systems
    has been backported. (#272)
  • The PYTHON_ZSTANDARD_IMPORT_POLICY environment variable now has leading
    and trailing whitespace stripped. Values like cffi and cffi are
    now equivalent to cffi.
  • The CI jobs for building wheels have been overhauled to always use
    cibuildwheel and uv (where possible). This change should be backwards
    compatible. But wheel building for this project has historically been
    fragile and there may be unwanted changes. We're optimistic that standardizing
    on uv (except for musllinux ppc64le and s390x where uv isn't available)
    will lead to more stability over time.
  • CI now runs tests against the wheels we distribute. Previously, we ran
    tests against a separate build that was theoretically identical. But the
    builds may have been subtly different, leading to preventable bugs in our
    wheels. (Enabling this test coverage did not uncover any failures.)
  • The pyproject.toml build backend has been switched from
    setuptools.build_meta:__legacy__ to setuptools.build_meta.
  • The setuptools build dependency has been upgraded from <69.0.0 to >=77.0.0.
    Modern versions of setuptools broke
    --config-settings=--build-option=... as part of implementing PEP 660.
    A workaround is to use --config-settings=--global-option=... instead.
    --global-option apparently is deprecated and the setuptools folks have yet
    to figure out how to thread config settings into setup.py invocations.
    (--build-option is sent to the build_wheel command but not the
    build_editable command.)
  • Python 3.14 wheels are now built with manylinux_2_28 (versus
    manylinux2014) for older Python versions. This may raise the minimum
    glibc version, effectively dropping support for Debian 8 and 9, Ubuntu
    13.10 through 18.04, Fedora 19 to 28, and RHEL/Centos 7. However, in
    practice most platforms don't container newer glibc symbols and are still
    ABI compatible with manylinux2014 and glibc 2.17.
  • We now require cffi >= 2.0.0b on Python 3.14. <3.14 still requires 1.17.
    (#274)
  • The cffi backend is now automatically disabled for free-threaded builds
    on Python <3.14, as cffi didn't implement free-threaded support until
    the 2.0 release. (#274)
  • Added CI coverage for free-threaded CPython 3.13 and 3.14. We do not yet
    formally support free-threaded builds. (#276)
  • The C and Rust backends now declare the GIL as unused.
  • The pythoncapi_compat.h file has been upgraded to the latest version. (#278)
  • setup.py now depends on packaging and uses packaging.version.Version
    for version comparisons. This removes some deprecation warnings from usage of
    legacy distutils Version classes.
  • Relax run-time libzstd version checking in C extension from exactly 1.5.7
    to >=1.5.6. (#254, #267)
  • C extension types now (correctly) declare their fully qualified type names
    as zstandard.backend_c.* versus zstd.* before. The names have been
    subtly broken for years. We believe the only practical exposure to this change
    is via pickling (possibly encountered when using the multiprocessing or
    concurrent.futures packages), which would fail to pickle types like
    ZstdError before since the fully qualified type name referenced an
    incorrect and likely missing package (zstd). (#248)

0.24.0

17 Aug 18:20
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • Support for Python 3.8 has been dropped because it reached end of life. Python 3.9 is the minimum supported Python version. The code should still be compatible with Python 3.8 and removing of version checks from setup.py will likely yield a working install. However, this is not officially supported.

Changes

  • Bundled zstd library upgraded from 1.5.6 to 1.5.7. (#255)
  • We now use and require cffi 1.17.0 or newer. Previously, the constraint was >=1.11.0 on Python <3.13.
  • The pyproject.toml file now defines a [project] section.
  • We now use GitHub's native ARM Linux runners to build wheels and run tests. Previously, Linux ARM wheels were built inside a QEMU virtualized environment and we didn't run tests on this platform.
  • We now use GitHub's native ARM Windows runners to build wheels and run tests. Previously, Windows ARM wheels were cross compiled from an x86-64 runner and we never ran tests for the Windows ARM platform.
  • We now collections.abs.Buffer on Python 3.12+ instead of typing.ByteString, as typing.ByteString was deprecated and later removed. (#238, #262)
  • PyO3 Rust crate upgraded from 0.21 to 0.22 (#257) and later to 0.24.
  • Removed CI coverage for PyPy 3.9.
  • Added CI coverage for PyPy 3.11.
  • Anaconda Windows CI builds have been disabled because we're running into an apparent conda bug.
  • Added CI coverage for Anaconda 3.12 and 3.13 on Linux and Windows x86-64 (but the Windows builds no-op due to above issue).
  • get_frame_parameters() now accepts an optional format argument defining the zstandard frame type. You can pass e.g. zstandard.FORMAT_ZSTD1_MAGICLESS to decode frames without header magic. (#217)
  • Initial Python 3.14 support. We build wheels and have CI test coverage.

Source Archive Publishing Error

During the release process of this version, we uploaded the source archive to PyPI after some wheels. PyPI rejected the source archive because of presence of a license-file entry while using metadata version 2.4. We manually generated the source distribution locally. The source distribution on PyPI therefore does not match what GitHub Actions produced.

0.22.0

01 Nov 06:17
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • ZstdDecompressor.decompressobj() will change read_across_frames to
    default to True in a future release. If you depend on the current
    functionality of stopping at frame boundaries, start explicitly passing
    read_across_frames=False to preserve the current behavior.
  • manylinux2010 wheels are no longer published since this wheel format
    is no longer supported by the pypa/manylinux project.
  • Removed CI coverage for PyPy 3.7 and 3.8, which are no longer supported
    PyPy versions.
  • Support for Python 3.7 has been dropped because it reached end of life.
    Python 3.8 is the minimum supported Python version. The code should still be
    compatible with Python 3.7 and removing of version checks from setup.py
    will likely yield a working install. However, this is no officially supported.

Changes

  • ZstdDecompressor.decompressobj() now accepts a read_across_frames
    boolean named argument to control whether to transparently read across
    multiple zstd frames. It defaults to False to preserve existing
    behavior.
  • Added CI coverage for PyPy 3.10.
  • Added CI coverage for newer Anaconda Python versions.
  • Packages used in CI have been upgraded to latest versions. This should
    nominally only impact developers of this project and not end-users.
  • pyproject.toml now declares a [build-system] section saying to build
    with setuptools.
  • CI now builds wheels with pip instead of setup.py directly.
  • Official support for CPython 3.12. Binary wheels for 3.12 are now published
    during releases. There were no meaningful code changes to support Python 3.12.
  • Binary wheels for musllinux_1_1 x86_64 and aarch64 are now being built and
    published.

0.21.0

01 Nov 06:18
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • Support for Python 3.6 has been dropped. Python 3.7 is the minimum supported
    Python version.

Changes

  • Bundled zstd library upgraded from 1.5.4 to 1.5.5.
  • PyO3 Rust crate upgraded from 0.15 to 0.18.
  • CI environment changed from Ubuntu 20.04 -> 22.04, Windows 2019 -> 2022,
    macOS 11 -> macOS 12.
  • C types now use PyType_Spec and corresponding APIs. (#187) Contributed by
    Mike Hommey.

0.20.0

20 Feb 22:00
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • This will likely be the last release officially supporting Python 3.6.
    Python 3.6 is end of life as of 2021-12-23.

Changes

  • Bundled zstd library upgraded from 1.5.2 to 1.5.4.
  • Use of the deprecated ZSTD_copyDCtx() was removed from the C and
    Rust backends.

0.19.0

30 Oct 01:10
Compare
Choose a tag to compare

Bug Fixes

  • The C backend implementation of ZstdDecompressionObj.decompress() could
    have raised an assertion in cases where the function was called multiple
    times on an instance. In non-debug builds, calls to this method could have
    leaked memory.

Changes

  • PyPy 3.6 support dropped; Pypy 3.8 and 3.9 support added.
  • Anaconda 3.6 support dropped.
  • Official support for Python 3.11. This did not require meaningful code changes
    and previous release(s) likely worked with 3.11 without any changes.
  • CFFI's build system now respects distutils's compiler.preprocessor if it
    is set. (#179)
  • The internal logic of ZstdDecompressionObj.decompress() was refactored.
    This may have fixed unconfirmed issues where unused_data was set
    prematurely. The new logic will also avoid an extra call to
    ZSTD_decompressStream() in some scenarios, possibly improving performance.
  • ZstdDecompressor.decompress() how has a read_across_frames keyword
    argument. It defaults to False. True is not yet implemented and will raise an
    exception if used. The new argument will default to True in a future release
    and is provided now so callers can start passing read_across_frames=False
    to preserve the existing functionality during a future upgrade.
  • ZstdDecompressor.decompress() now has an allow_extra_data keyword
    argument to control whether an exception is raised if input contains extra
    data. It defaults to True, preserving existing behavior of ignoring extra
    data. It will likely default to False in a future release. Callers desiring
    the current behavior are encouraged to explicitly pass
    allow_extra_data=True so behavior won't change during a future upgrade.

0.16.0

16 Oct 21:49
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • Support for Python 3.5 has been dropped. Python 3.6 is now the minimum required Python version.

Changes

  • Bundled zstd library upgraded from 1.4.8 to 1.5.0.
  • manylinux2014_aarch64 wheels are now being produced for CPython 3.6+. (#145).
  • Wheels are now being produced for CPython 3.10.
  • Arguments to ZstdCompressor() and ZstdDecompressor() are now all optional in the C backend and an explicit None value is accepted. Before, the C backend wouldn't accept an explicit None value (but the CFFI backend would). The new behavior should be consistent between the backends. (#153)

0.15.2

28 Feb 01:30
Compare
Choose a tag to compare

0.15.2 (released 2021-02-27)

Backwards Compatibility Notes

  • ZstdCompressor.multi_compress_to_buffer() and
    ZstdDecompressor.multi_decompress_to_buffer() are no longer
    available when linking against a system zstd library. These
    experimental features are only available when building against the
    bundled single file zstd C source file distribution. (#106)

Changes

  • setup.py now recognizes a ZSTD_EXTRA_COMPILER_ARGS
    environment variable to specify additional compiler arguments
    to use when compiling the C backend.
  • PyPy build and test coverage has been added to CI.
  • Added CI jobs for building against external zstd library.
  • Wheels supporting macOS ARM/M1 devices are now being produced.
  • References to Python 2 have been removed from the in-repo Debian packaging
    code.
  • Significant work has been made on a Rust backend. It is currently feature
    complete but not yet optimized. We are not yet shipping the backend as part
    of the distributed wheels until it is more mature.
  • The .pyi type annotations file has replaced various default argument
    values with ....

0.15.1

31 Dec 23:41
Compare
Choose a tag to compare

Bug Fixes

  • setup.py no longer attempts to build the C backend on PyPy. (#130)
  • <sys/types.h> is now included before <sys/sysctl.h>. This was
    the case in releases prior to 0.15.0 and the include order was reversed
    as part of running clang-format. The old/working order has been
    restored. (#128)
  • Include some private zstd C headers so we can build the C extension against
    a system library. The previous behavior of referencing these headers is
    restored. That behave is rather questionable and undermines the desire to
    use the system zstd.

0.15.0

29 Dec 18:28
Compare
Choose a tag to compare

Backwards Compatibility Notes

  • Support for Python 2.7 has been dropped. Python 3.5 is now the
    minimum required Python version. (#109)
  • train_dictionary() now uses the fastcover training mechanism
    (as opposed to cover). Some parameter values that worked with the old
    mechanism may not work with the new one. e.g. d must be 6 or 8
    if it is defined.
  • train_dictionary() now always calls
    ZDICT_optimizeTrainFromBuffer_fastCover() instead of different APIs
    depending on which arguments were passed.
  • The names of various Python modules have been changed. The C extension
    is now built as zstandard.backend_c instead of zstd. The
    CFFI extension module is now built as zstandard._cffi instead of
    _zstd_cffi. The CFFI backend is now zstandard.backend_cffi instead
    of zstandard.cffi.
  • ZstdDecompressionReader.seekable() now returns False instead of
    True because not all seek operations are supported and some Python
    code in the wild keys off this value to determine if seek() can be
    called for all scenarios.
  • ZstdDecompressionReader.seek() now raises OSError instead of
    ValueError when the seek cannot be fulfilled. (#107)
  • ZstdDecompressionReader.readline() and
    ZstdDecompressionReader.readlines() now accept an integer argument.
    This makes them conform with the IO interface. The methods still raise
    io.UnsupportedOperation.
  • ZstdCompressionReader.__enter__ and ZstdDecompressionReader.__enter__
    now raise ValueError if the instance was already closed.
  • The deprecated overlap_size_log attribute on ZstdCompressionParameters
    instances has been removed. The overlap_log attribute should be used
    instead.
  • The deprecated overlap_size_log argument to ZstdCompressionParameters
    has been removed. The overlap_log argument should be used instead.
  • The deprecated ldm_hash_every_log attribute on
    ZstdCompressionParameters instances has been removed. The
    ldm_hash_rate_log attribute should be used instead.
  • The deprecated ldm_hash_every_log argument to
    ZstdCompressionParameters has been removed. The ldm_hash_rate_log
    argument should be used instead.
  • The deprecated CompressionParameters type alias to
    ZstdCompressionParamaters has been removed. Use
    ZstdCompressionParameters.
  • The deprecated aliases ZstdCompressor.read_from() and
    ZstdDecompressor.read_from() have been removed. Use the corresponding
    read_to_iter() methods instead.
  • The deprecated aliases ZstdCompressor.write_to() and
    ZstdDecompressor.write_to() have been removed. Use the corresponding
    stream_writer() methods instead.
  • ZstdCompressor.copy_stream(), ZstdCompressorIterator.__next__(),
    and ZstdDecompressor.copy_stream() now raise the original exception
    on error calling the source stream's read() instead of raising
    ZstdError. This only affects the C backend.
  • ZstdDecompressionObj.flush() now returns bytes instead of
    None. This makes it behave more similarly to flush() methods
    for similar types in the Python standard library. (#78)
  • ZstdCompressionWriter.__exit__() now always calls close().
    Previously, close() would not be called if the context manager
    raised an exception. The old behavior was inconsistent with other
    stream types in this package and with the behavior of Python's
    standard library IO types. (#86)
  • Distribution metadata no longer lists cffi as an install_requires
    except when running on PyPy. Instead, cffi is listed as an
    extras_require.
  • ZstdCompressor.stream_reader() and ZstdDecompressor.stream_reader()
    now default to closing the source stream when the instance is itself
    closed. To change this behavior, pass closefd=False. (#76)
  • The CFFI backend now defines
    ZstdCompressor.multi_compress_to_buffer() and
    ZstdDecompressor.multi_decompress_to_buffer(). However, they
    raise NotImplementedError, as they are not yet implemented.
  • The CFFI backend now exposes the types ZstdCompressionChunker,
    ZstdCompressionObj, ZstdCompressionReader,
    ZstdCompressionWriter, ZstdDecompressionObj,
    ZstdDecompressionReader, and ZstdDecompressionWriter as
    symbols on the zstandard module.
  • The CFFI backend now exposes the types BufferSegment,
    BufferSegments, BufferWithSegments, and
    BufferWithSegmentsCollection. However, they are not implemented.
  • ZstdCompressionWriter.flush() now calls flush() on the inner stream
    if such a method exists. However, when close() itself calls
    self.flush(), flush() is not called on the inner stream.
  • ZstdDecompressionWriter.close() no longer calls flush() on
    the inner stream. However, ZstdDecompressionWriter.flush() still
    calls flush() on the inner stream.
  • ZstdCompressor.stream_writer() and ZstdDecompressor.stream_writer()
    now have their write_return_read argument default to True.
    This brings the behavior of write() in compliance with the
    io.RawIOBase interface by default. The argument may be removed
    in a future release.
  • ZstdCompressionParameters no longer exposes a compression_strategy
    property. Its constructor no longer accepts a compression_strategy
    argument. Use the strategy property/argument instead.

Bug Fixes

  • Fix a memory leak in stream_reader decompressor when reader is closed
    before reading everything. (Patch by Pierre Fersing.)
  • The C backend now properly checks for errors after calling IO methods
    on inner streams in various methods. ZstdCompressionWriter.write()
    now catches exceptions when calling the inner stream's write().
    ZstdCompressionWriter.flush() on inner stream's write().
    ZstdCompressor.copy_stream() on dest stream's write().
    ZstdDecompressionWriter.write() on inner stream's write().
    ZstdDecompressor.copy_stream() on dest stream's write(). (#102)

Changes

  • Bundled zstandard library upgraded from 1.4.5 to 1.4.8.
  • The bundled zstandard library is now using the single C source file
    distribution. The 2 main header files are still present, as these are
    needed by CFFI to generate the CFFI bindings.
  • PyBuffer instances are no longer checked to be C contiguous and
    have a single dimension. The former was redundant with what
    PyArg_ParseTuple() already did and the latter is not necessary
    in practice because very few extension modules create buffers with
    more than 1 dimension. (#124)
  • Added Python typing stub file for the zstandard module. (#120)
  • The make_cffi.py script should now respect the CC environment
    variable for locating the compiler. (#103)
  • CI now properly uses the cffi backend when running all tests.
  • train_dictionary() has been rewritten to use the fastcover APIs
    and to consistently call ZDICT_optimizeTrainFromBuffer_fastCover()
    instead of different C APIs depending on what arguments were passed.
    The function also now accepts arguments f, split_point, and
    accel, which are parameters unique to fastcover.
  • CI now tests and builds wheels for Python 3.9.
  • zstd.c file renamed to c-ext/backend_c.c.
  • All built/installed Python modules are now in the zstandard
    package. Previously, there were modules in other packages. (#115)
  • C source code is now automatically formatted with clang-format.
  • ZstdCompressor.stream_writer(), ZstdCompressor.stream_reader(),
    ZstdDecompressor.stream_writer(), and
    ZstdDecompressor.stream_reader() now accept a closefd
    argument to control whether the underlying stream should be closed
    when the ZstdCompressionWriter, ZstdCompressReader,
    ZstdDecompressionWriter, or ZstdDecompressionReader is closed.
    (#76)
  • There is now a zstandard.open() function for returning a file
    object with zstd (de)compression. (#64)
  • The zstandard module now exposes a backend_features
    attribute containing a set of strings denoting optional features
    present in that backend. This can be used to sniff feature support
    by performing a string lookup instead of sniffing for API presence
    or behavior.
  • Python docstrings have been moved from the C backend to the CFFI
    backend. Sphinx docs have been updated to generate API documentation
    via the CFFI backend. Documentation for Python APIs is now fully
    defined via Python docstrings instead of spread across Sphinx ReST
    files and source code.
  • ZstdCompressionParameters now exposes a strategy property.
  • There are now compress() and decompress() convenience functions
    on the zstandard module. These are simply wrappers around the
    corresponding APIs on ZstdCompressor and ZstdDecompressor.