Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pyzstd for openSUSE:Factory checked in at 2025-11-26 17:18:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyzstd (Old) and /work/SRC/openSUSE:Factory/.python-pyzstd.new.14147 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyzstd" Wed Nov 26 17:18:48 2025 rev:8 rq:1320160 version:0.18.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyzstd/python-pyzstd.changes 2025-05-23 14:31:51.247873658 +0200 +++ /work/SRC/openSUSE:Factory/.python-pyzstd.new.14147/python-pyzstd.changes 2025-11-26 17:19:11.363688371 +0100 @@ -1,0 +2,16 @@ +Wed Nov 26 10:30:35 UTC 2025 - John Paul Adrian Glaubitz <[email protected]> + +- Update to 0.18.0 + * Support for Python 3.14 + * Build free-threaded wheels for CPython 3.13 and 3.14, + even if the feature is not supported + * Deprecate the `read_size` and `write_size` parameters + of `ZstdFile` and `SeekableZstdFile` + * Deprecate `richmem_compress` and `RichMemZstdCompressor` + * Rework documentation to suggest using `compression.zstd` + from Python stdlib, and provide a migration guide + * Include the `zstd` library license in package distributions +- Add sed command to remove shebang from src/__main__.py +- Don't remove zstd folder in %setup section, it's temporarily required + +------------------------------------------------------------------- Old: ---- pyzstd-0.17.0.tar.gz New: ---- pyzstd-0.18.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyzstd.spec ++++++ --- /var/tmp/diff_new_pack.37LouQ/_old 2025-11-26 17:19:12.663743215 +0100 +++ /var/tmp/diff_new_pack.37LouQ/_new 2025-11-26 17:19:12.667743384 +0100 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-pyzstd -Version: 0.17.0 +Version: 0.18.0 Release: 0 Summary: Python bindings to Zstandard (zstd) compression library License: BSD-3-Clause @@ -45,8 +45,8 @@ %setup -q -n pyzstd-%{version} # make sure we link dynamically, cannot use command line argument to pip wheel # gh#animalize/pyzstd#18 -rm -r zstd sed -i "s/has_option('--dynamic-link-zstd')/True/" setup.py +sed -i "/\#\!\/usr\/bin\/env\ python3/d" src/__main__.py %build export CFLAGS="%{optflags}" ++++++ pyzstd-0.17.0.tar.gz -> pyzstd-0.18.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/CHANGELOG.md new/pyzstd-0.18.0/CHANGELOG.md --- old/pyzstd-0.17.0/CHANGELOG.md 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/CHANGELOG.md 2025-10-05 09:02:19.000000000 +0200 @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## 0.18.0 (October 5, 2025) + +- Support for Python 3.14 +- Deprecate the `read_size` and `write_size` parameters of `ZstdFile` and `SeekableZstdFile` +- Deprecate `richmem_compress` and `RichMemZstdCompressor` +- Rework documentation to suggest using `compression.zstd` from Python stdlib, and provide a migration guide +- Include the `zstd` library license in package distributions + ## 0.17.0 (May 10, 2025) - Upgrade zstd source code from v1.5.6 to [v1.5.7](https://github.com/facebook/zstd/releases/tag/v1.5.7) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/LICENSE_zstd new/pyzstd-0.18.0/LICENSE_zstd --- old/pyzstd-0.17.0/LICENSE_zstd 1970-01-01 01:00:00.000000000 +0100 +++ new/pyzstd-0.18.0/LICENSE_zstd 2025-10-05 09:02:27.000000000 +0200 @@ -0,0 +1,37 @@ +Depending on how it is build, this package may distribute the zstd library, +partially or in its integrality, in source or binary form. + +Its license is reproduced below. + +--- + +BSD License + +For Zstandard software + +Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook, nor Meta, nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/MANIFEST.in new/pyzstd-0.18.0/MANIFEST.in --- old/pyzstd-0.17.0/MANIFEST.in 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/MANIFEST.in 2025-10-05 09:02:19.000000000 +0200 @@ -3,6 +3,7 @@ include LICENSE include README.md +include zstd/LICENSE recursive-include zstd/lib * recursive-include src * recursive-include tests * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/PKG-INFO new/pyzstd-0.18.0/PKG-INFO --- old/pyzstd-0.17.0/PKG-INFO 2025-05-10 15:20:27.759146700 +0200 +++ new/pyzstd-0.18.0/PKG-INFO 2025-10-05 09:02:27.972537500 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pyzstd -Version: 0.17.0 +Version: 0.18.0 Summary: Python bindings to Zstandard (zstd) compression library. Home-page: https://github.com/Rogdham/pyzstd Author: Ma Lin @@ -20,9 +20,11 @@ Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 Requires-Python: >=3.5 Description-Content-Type: text/markdown License-File: LICENSE +License-File: LICENSE_zstd Requires-Dist: typing-extensions>=4.13.2; python_version < "3.13" <div align="center" size="15px"> @@ -37,20 +39,26 @@ --- -[π Documentation](https://pyzstd.readthedocs.io/) | [π Changelog](./CHANGELOG.md) +[π Documentation][doc] | [π Changelog](./CHANGELOG.md) </div> --- -Pyzstd module provides classes and functions for compressing and decompressing data, using Facebook's [Zstandard](http://www.zstd.net) (or zstd as short name) algorithm. +The `pyzstd` module provides Python support for [Zstandard](http://www.zstd.net), using +an API style similar to the `bz2`, `lzma`, and `zlib` modules. -The API style is similar to Python's bz2/lzma/zlib modules. - -- Includes zstd v1.5.6 source code -- Can also dynamically link to zstd library provided by system, see [this note](https://pyzstd.readthedocs.io/#build-pyzstd). -- Has a CFFI implementation that can work with PyPy -- Support sub-interpreter on CPython 3.12+ -- `ZstdFile` class has C language level performance -- Supports [Zstandard Seekable Format](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md) -- Has a command line interface: `python -m pyzstd --help` +> [!WARNING] +> +> Zstandard is now natively supported in Pythonβs standard library via the +> [`compression.zstd` module][compression.zstd]. For older Python versions, use the +> [`backports.zstd` library][backports.zstd] as a fallback. +> +> We recommend new projects to use the standard library, and existing ones to consider +> migrating. +> +> See [`pyzstd`'s documentation][doc] for details and a migration guide. + +[doc]: https://pyzstd.readthedocs.io/ +[compression.zstd]: https://docs.python.org/3.14/library/compression.zstd.html +[backports.zstd]: https://github.com/Rogdham/backports.zstd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/README.md new/pyzstd-0.18.0/README.md --- old/pyzstd-0.17.0/README.md 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/README.md 2025-10-05 09:02:19.000000000 +0200 @@ -10,20 +10,26 @@ --- -[π Documentation](https://pyzstd.readthedocs.io/) | [π Changelog](./CHANGELOG.md) +[π Documentation][doc] | [π Changelog](./CHANGELOG.md) </div> --- -Pyzstd module provides classes and functions for compressing and decompressing data, using Facebook's [Zstandard](http://www.zstd.net) (or zstd as short name) algorithm. +The `pyzstd` module provides Python support for [Zstandard](http://www.zstd.net), using +an API style similar to the `bz2`, `lzma`, and `zlib` modules. -The API style is similar to Python's bz2/lzma/zlib modules. - -- Includes zstd v1.5.6 source code -- Can also dynamically link to zstd library provided by system, see [this note](https://pyzstd.readthedocs.io/#build-pyzstd). -- Has a CFFI implementation that can work with PyPy -- Support sub-interpreter on CPython 3.12+ -- `ZstdFile` class has C language level performance -- Supports [Zstandard Seekable Format](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md) -- Has a command line interface: `python -m pyzstd --help` +> [!WARNING] +> +> Zstandard is now natively supported in Pythonβs standard library via the +> [`compression.zstd` module][compression.zstd]. For older Python versions, use the +> [`backports.zstd` library][backports.zstd] as a fallback. +> +> We recommend new projects to use the standard library, and existing ones to consider +> migrating. +> +> See [`pyzstd`'s documentation][doc] for details and a migration guide. + +[doc]: https://pyzstd.readthedocs.io/ +[compression.zstd]: https://docs.python.org/3.14/library/compression.zstd.html +[backports.zstd]: https://github.com/Rogdham/backports.zstd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/pyzstd.egg-info/PKG-INFO new/pyzstd-0.18.0/pyzstd.egg-info/PKG-INFO --- old/pyzstd-0.17.0/pyzstd.egg-info/PKG-INFO 2025-05-10 15:20:27.000000000 +0200 +++ new/pyzstd-0.18.0/pyzstd.egg-info/PKG-INFO 2025-10-05 09:02:27.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pyzstd -Version: 0.17.0 +Version: 0.18.0 Summary: Python bindings to Zstandard (zstd) compression library. Home-page: https://github.com/Rogdham/pyzstd Author: Ma Lin @@ -20,9 +20,11 @@ Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 Requires-Python: >=3.5 Description-Content-Type: text/markdown License-File: LICENSE +License-File: LICENSE_zstd Requires-Dist: typing-extensions>=4.13.2; python_version < "3.13" <div align="center" size="15px"> @@ -37,20 +39,26 @@ --- -[π Documentation](https://pyzstd.readthedocs.io/) | [π Changelog](./CHANGELOG.md) +[π Documentation][doc] | [π Changelog](./CHANGELOG.md) </div> --- -Pyzstd module provides classes and functions for compressing and decompressing data, using Facebook's [Zstandard](http://www.zstd.net) (or zstd as short name) algorithm. +The `pyzstd` module provides Python support for [Zstandard](http://www.zstd.net), using +an API style similar to the `bz2`, `lzma`, and `zlib` modules. -The API style is similar to Python's bz2/lzma/zlib modules. - -- Includes zstd v1.5.6 source code -- Can also dynamically link to zstd library provided by system, see [this note](https://pyzstd.readthedocs.io/#build-pyzstd). -- Has a CFFI implementation that can work with PyPy -- Support sub-interpreter on CPython 3.12+ -- `ZstdFile` class has C language level performance -- Supports [Zstandard Seekable Format](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md) -- Has a command line interface: `python -m pyzstd --help` +> [!WARNING] +> +> Zstandard is now natively supported in Pythonβs standard library via the +> [`compression.zstd` module][compression.zstd]. For older Python versions, use the +> [`backports.zstd` library][backports.zstd] as a fallback. +> +> We recommend new projects to use the standard library, and existing ones to consider +> migrating. +> +> See [`pyzstd`'s documentation][doc] for details and a migration guide. + +[doc]: https://pyzstd.readthedocs.io/ +[compression.zstd]: https://docs.python.org/3.14/library/compression.zstd.html +[backports.zstd]: https://github.com/Rogdham/backports.zstd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/pyzstd.egg-info/SOURCES.txt new/pyzstd-0.18.0/pyzstd.egg-info/SOURCES.txt --- old/pyzstd-0.17.0/pyzstd.egg-info/SOURCES.txt 2025-05-10 15:20:27.000000000 +0200 +++ new/pyzstd-0.18.0/pyzstd.egg-info/SOURCES.txt 2025-10-05 09:02:27.000000000 +0200 @@ -1,5 +1,6 @@ CHANGELOG.md LICENSE +LICENSE_zstd MANIFEST.in README.md pyproject.toml @@ -18,7 +19,6 @@ src/_zstdfile.py src/py.typed src/_c/__init__.py -src/_c/_zstd.cpython-313-x86_64-linux-gnu.so src/_cffi/__init__.py src/_cffi/common.py src/_cffi/compressor.py @@ -39,6 +39,7 @@ tests/__init__.py tests/test_seekable.py tests/test_zstd.py +zstd/LICENSE zstd/lib/.gitignore zstd/lib/BUCK zstd/lib/Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/setup.py new/pyzstd-0.18.0/setup.py --- old/pyzstd-0.17.0/setup.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/setup.py 2025-10-05 09:02:19.000000000 +0200 @@ -22,6 +22,20 @@ m = re.search(r'''__version__\s*=\s*(['"])(.*?)\1''', file_content) module_version = m.group(2) + # Create LICENSE_zstd + LICENSE_ZSTD_SRC = os.path.join(ROOT_PATH, 'zstd', 'LICENSE') + with open(LICENSE_ZSTD_SRC, 'r', encoding='utf-8') as file: + license_zstd = file.read() + LICENSE_ZSTD_DST = os.path.join(ROOT_PATH, 'LICENSE_zstd') + with open(LICENSE_ZSTD_DST, 'w', encoding='utf-8') as file: + file.write( + "Depending on how it is build, this package may distribute the zstd library,\n" + "partially or in its integrality, in source or binary form.\n\n" + "Its license is reproduced below.\n\n" + "---\n\n" + ) + file.write(license_zstd) + return long_description, module_version def get_zstd_files_list(): @@ -218,6 +232,7 @@ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ], keywords='zstandard zstd zst compress decompress tar file seekable format', package_dir={'pyzstd': 'src'}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/src/__init__.py new/pyzstd-0.18.0/src/__init__.py --- old/pyzstd-0.17.0/src/__init__.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/src/__init__.py 2025-10-05 09:02:19.000000000 +0200 @@ -5,7 +5,7 @@ DParameter, EndlessZstdDecompressor, PYZSTD_CONFIG, - RichMemZstdCompressor, + RichMemZstdCompressor as _RichMemZstdCompressor, Strategy, ZstdCompressor, ZstdDecompressor, @@ -34,7 +34,7 @@ DParameter, EndlessZstdDecompressor, PYZSTD_CONFIG, - RichMemZstdCompressor, + RichMemZstdCompressor as _RichMemZstdCompressor, Strategy, ZstdCompressor, ZstdDecompressor, @@ -75,7 +75,7 @@ from typing_extensions import deprecated -__version__ = '0.17.0' +__version__ = '0.18.0' __doc__ = '''\ Python bindings to Zstandard (zstd) compression library, the API style is @@ -118,6 +118,7 @@ return comp.compress(data, ZstdCompressor.FLUSH_FRAME) +@deprecated("See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.richmem_compress") def richmem_compress(data, level_or_option=None, zstd_dict=None): """Compress a block of data, return a bytes object. @@ -133,7 +134,7 @@ parameters. zstd_dict: A ZstdDict object, pre-trained dictionary for compression. """ - comp = RichMemZstdCompressor(level_or_option, zstd_dict) + comp = _RichMemZstdCompressor(level_or_option, zstd_dict) return comp.compress(data) @@ -242,3 +243,9 @@ @deprecated("See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.decompress_stream") def decompress_stream(*args, **kwargs): return _decompress_stream(*args, **kwargs) + +@deprecated("See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.RichMemZstdCompressor") +class RichMemZstdCompressor(_RichMemZstdCompressor): + pass + +RichMemZstdCompressor.__doc__ = _RichMemZstdCompressor.__doc__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/src/__init__.pyi new/pyzstd-0.18.0/src/__init__.pyi --- old/pyzstd-0.17.0/src/__init__.pyi 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/src/__init__.pyi 2025-10-05 09:02:19.000000000 +0200 @@ -100,6 +100,7 @@ def _set_pledged_input_size(self, size: Union[int, None]) -> None: ... +@deprecated("See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.RichMemZstdCompressor") class RichMemZstdCompressor: def __init__(self, level_or_option: Union[None, int, Dict[CParameter, int]] = None, @@ -143,6 +144,7 @@ level_or_option: Union[None, int, Dict[CParameter, int]] = None, zstd_dict: Union[None, ZstdDict, ZstdDictInfo] = None) -> bytes: ... +@deprecated("See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.richmem_compress") def richmem_compress(data, level_or_option: Union[None, int, Dict[CParameter, int]] = None, zstd_dict: Union[None, ZstdDict, ZstdDictInfo] = None) -> bytes: ... Binary files old/pyzstd-0.17.0/src/_c/_zstd.cpython-313-x86_64-linux-gnu.so and new/pyzstd-0.18.0/src/_c/_zstd.cpython-313-x86_64-linux-gnu.so differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/src/_seekable_zstdfile.py new/pyzstd-0.18.0/src/_seekable_zstdfile.py --- old/pyzstd-0.17.0/src/_seekable_zstdfile.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/src/_seekable_zstdfile.py 2025-10-05 09:02:19.000000000 +0200 @@ -6,7 +6,7 @@ from pyzstd._zstdfile import _ZstdDecompressReader, ZstdFile, \ _MODE_CLOSED, _MODE_READ, _MODE_WRITE, \ - PathLike, io + PathLike, io, _DEPRECATED_PLACEHOLDER __all__ = ('SeekableFormatError', 'SeekableZstdFile') @@ -397,7 +397,7 @@ def __init__(self, filename, mode="r", *, level_or_option=None, zstd_dict=None, - read_size=131075, write_size=131591, + read_size=_DEPRECATED_PLACEHOLDER, write_size=_DEPRECATED_PLACEHOLDER, max_frame_content_size=1024*1024*1024): """Open a Zstandard Seekable Format file in binary mode. In read mode, the file can be 0-size file. @@ -421,13 +421,6 @@ support int type compression level in this case. zstd_dict: A ZstdDict object, pre-trained dictionary for compression / decompression. - read_size: In reading mode, this is bytes number that read from the - underlying file object each time, default value is zstd's - recommended value. If use with Network File System, increasing - it may get better performance. - write_size: In writing modes, this is output buffer's size, default - value is zstd's recommended value. If use with Network File - System, increasing it may get better performance. max_frame_content_size: In write/append modes (compression), when the uncompressed data size reaches max_frame_content_size, a frame is generated automatically. If the size is small, it will increase diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/src/_zstdfile.py new/pyzstd-0.18.0/src/_zstdfile.py --- old/pyzstd-0.17.0/src/_zstdfile.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/src/_zstdfile.py 2025-10-05 09:02:19.000000000 +0200 @@ -1,4 +1,5 @@ import io +import warnings try: from os import PathLike except ImportError: @@ -74,6 +75,11 @@ _MODE_READ = 1 _MODE_WRITE = 2 +class _DeprecatedPlaceholder: + def __repr__(self): + return '<DEPRECATED>' +_DEPRECATED_PLACEHOLDER = _DeprecatedPlaceholder() + class ZstdFile(io.BufferedIOBase): """A file object providing transparent zstd (de)compression. @@ -91,7 +97,7 @@ def __init__(self, filename, mode="r", *, level_or_option=None, zstd_dict=None, - read_size=131075, write_size=131591): + read_size=_DEPRECATED_PLACEHOLDER, write_size=_DEPRECATED_PLACEHOLDER): """Open a zstd compressed file in binary mode. filename can be either an actual file name (given as a str, bytes, or @@ -110,14 +116,16 @@ support int type compression level in this case. zstd_dict: A ZstdDict object, pre-trained dictionary for compression / decompression. - read_size: In reading mode, this is bytes number that read from the - underlying file object each time, default value is zstd's - recommended value. If use with Network File System, increasing - it may get better performance. - write_size: In writing modes, this is output buffer's size, default - value is zstd's recommended value. If use with Network File - System, increasing it may get better performance. """ + if read_size == _DEPRECATED_PLACEHOLDER: + read_size = 131075 + else: + warnings.warn("pyzstd.ZstdFile()'s read_size parameter is deprecated", DeprecationWarning, stacklevel=2) + if write_size == _DEPRECATED_PLACEHOLDER: + write_size = 131591 + else: + warnings.warn("pyzstd.ZstdFile()'s write_size parameter is deprecated", DeprecationWarning, stacklevel=2) + self._fp = None self._closefp = False self._mode = _MODE_CLOSED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/tests/test_seekable.py new/pyzstd-0.18.0/tests/test_seekable.py --- old/pyzstd-0.17.0/tests/test_seekable.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/tests/test_seekable.py 2025-10-05 09:02:19.000000000 +0200 @@ -1,3 +1,4 @@ +from contextlib import contextmanager import array import gc import io @@ -7,6 +8,7 @@ import sys import tempfile import unittest +import warnings from io import BytesIO from math import ceil @@ -28,6 +30,21 @@ from pyzstd import PYZSTD_CONFIG # type: ignore from pyzstd._seekable_zstdfile import _SeekTable +@contextmanager +def _check_deprecated(testcase): + with warnings.catch_warnings(record=True) as warns: + yield + testcase.assertEqual(len(warns), 1) + warn = warns[0] + testcase.assertEqual(warn.category, DeprecationWarning) + testcase.assertIn( + str(warn.message), + [ + "pyzstd.ZstdFile()'s read_size parameter is deprecated", + "pyzstd.ZstdFile()'s write_size parameter is deprecated", + ] + ) + BIT_BUILD = PYZSTD_CONFIG[0] DECOMPRESSED = b'1234567890' assert len(DECOMPRESSED) == 10 @@ -787,27 +804,37 @@ SeekableZstdFile(b, 'r', max_frame_content_size=100) def test_init_sizes_arg(self): - with SeekableZstdFile(BytesIO(), 'r', read_size=1): - pass - with self.assertRaises(ValueError): - SeekableZstdFile(BytesIO(), 'r', read_size=0) - with self.assertRaises(ValueError): - SeekableZstdFile(BytesIO(), 'r', read_size=-1) - with self.assertRaises(TypeError): - SeekableZstdFile(BytesIO(), 'r', read_size=(10,)) - with self.assertRaisesRegex(ValueError, 'read_size'): - SeekableZstdFile(BytesIO(), 'w', read_size=10) + with _check_deprecated(self): + with SeekableZstdFile(BytesIO(), 'r', read_size=1): + pass + with _check_deprecated(self): + with self.assertRaises(ValueError): + SeekableZstdFile(BytesIO(), 'r', read_size=0) + with _check_deprecated(self): + with self.assertRaises(ValueError): + SeekableZstdFile(BytesIO(), 'r', read_size=-1) + with _check_deprecated(self): + with self.assertRaises(TypeError): + SeekableZstdFile(BytesIO(), 'r', read_size=(10,)) + with _check_deprecated(self): + with self.assertRaisesRegex(ValueError, 'read_size'): + SeekableZstdFile(BytesIO(), 'w', read_size=10) - with SeekableZstdFile(BytesIO(), 'w', write_size=1): - pass - with self.assertRaises(ValueError): - SeekableZstdFile(BytesIO(), 'w', write_size=0) - with self.assertRaises(ValueError): - SeekableZstdFile(BytesIO(), 'w', write_size=-1) - with self.assertRaises(TypeError): - SeekableZstdFile(BytesIO(), 'w', write_size=(10,)) - with self.assertRaisesRegex(ValueError, 'write_size'): - SeekableZstdFile(BytesIO(), 'r', write_size=10) + with _check_deprecated(self): + with SeekableZstdFile(BytesIO(), 'w', write_size=1): + pass + with _check_deprecated(self): + with self.assertRaises(ValueError): + SeekableZstdFile(BytesIO(), 'w', write_size=0) + with _check_deprecated(self): + with self.assertRaises(ValueError): + SeekableZstdFile(BytesIO(), 'w', write_size=-1) + with _check_deprecated(self): + with self.assertRaises(TypeError): + SeekableZstdFile(BytesIO(), 'w', write_size=(10,)) + with _check_deprecated(self): + with self.assertRaisesRegex(ValueError, 'write_size'): + SeekableZstdFile(BytesIO(), 'r', write_size=10) def test_init_append_fail(self): # get a temp file name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/tests/test_zstd.py new/pyzstd-0.18.0/tests/test_zstd.py --- old/pyzstd-0.17.0/tests/test_zstd.py 2025-05-10 15:20:20.000000000 +0200 +++ new/pyzstd-0.18.0/tests/test_zstd.py 2025-10-05 09:02:19.000000000 +0200 @@ -99,8 +99,12 @@ testcase.assertIn( str(warn.message), [ + "pyzstd.ZstdFile()'s read_size parameter is deprecated", + "pyzstd.ZstdFile()'s write_size parameter is deprecated", "See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.compress_stream", "See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.decompress_stream", + "See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.richmem_compress", + "See https://pyzstd.readthedocs.io/en/stable/deprecated.html for alternatives to pyzstd.RichMemZstdCompressor", ] ) @@ -111,7 +115,7 @@ DAT_130K_D = bytes([random.randint(0, 127) for _ in range(130*1024)]) global DAT_130K_C - DAT_130K_C = richmem_compress(DAT_130K_D, {CParameter.checksumFlag:1}) + DAT_130K_C = compress(DAT_130K_D, {CParameter.checksumFlag:1}) global DECOMPRESSED_DAT DECOMPRESSED_DAT = b'abcdefg123456' * 1000 @@ -266,9 +270,12 @@ RichMemZstdCompressor.FLUSH_FRAME # method & member - RichMemZstdCompressor() - RichMemZstdCompressor(12, TRAINED_DICT) - c = RichMemZstdCompressor(level_or_option=4, zstd_dict=TRAINED_DICT) + with _check_deprecated(self): + RichMemZstdCompressor() + with _check_deprecated(self): + RichMemZstdCompressor(12, TRAINED_DICT) + with _check_deprecated(self): + c = RichMemZstdCompressor(level_or_option=4, zstd_dict=TRAINED_DICT) c.compress(b'123456') c.compress(data=b'123456') @@ -299,8 +306,9 @@ pickle.dumps(c) # supports subclass - class SubClass(RichMemZstdCompressor): - pass + with _check_deprecated(self): + class SubClass(RichMemZstdCompressor): + pass def test_Decompressor(self): # method & member @@ -728,7 +736,8 @@ def test_rich_mem_compress(self): b = THIS_FILE_BYTES[:len(THIS_FILE_BYTES)//3] - dat1 = richmem_compress(b) + with _check_deprecated(self): + dat1 = richmem_compress(b) dat2 = decompress(dat1) self.assertEqual(dat2, b) @@ -1219,12 +1228,14 @@ def test_compress_empty(self): # output empty content frame self.assertNotEqual(compress(b''), b'') - self.assertNotEqual(richmem_compress(b''), b'') + with _check_deprecated(self): + self.assertNotEqual(richmem_compress(b''), b'') c = ZstdCompressor() self.assertNotEqual(c.compress(b'', c.FLUSH_FRAME), b'') - c = RichMemZstdCompressor() + with _check_deprecated(self): + c = RichMemZstdCompressor() self.assertNotEqual(c.compress(b''), b'') # output b'' @@ -2154,7 +2165,8 @@ V1[mid+1:] # compress - dat = richmem_compress(V2, zstd_dict=zd.as_prefix) + with _check_deprecated(self): + dat = richmem_compress(V2, zstd_dict=zd.as_prefix) self.assertEqual(get_frame_info(dat).dictionary_id, 0) # decompress @@ -2177,13 +2189,15 @@ zd = TRAINED_DICT # test .as_digested_dict - dat = richmem_compress(SAMPLES[0], zstd_dict=zd.as_digested_dict) + with _check_deprecated(self): + dat = richmem_compress(SAMPLES[0], zstd_dict=zd.as_digested_dict) self.assertEqual(decompress(dat, zd.as_digested_dict), SAMPLES[0]) with self.assertRaises(AttributeError): zd.as_digested_dict = b'1234' # test .as_undigested_dict - dat = richmem_compress(SAMPLES[0], zstd_dict=zd.as_undigested_dict) + with _check_deprecated(self): + dat = richmem_compress(SAMPLES[0], zstd_dict=zd.as_undigested_dict) self.assertEqual(decompress(dat, zd.as_undigested_dict), SAMPLES[0]) with self.assertRaises(AttributeError): zd.as_undigested_dict = b'1234' @@ -2194,11 +2208,13 @@ CParameter.enableLongDistanceMatching: 1} # automatically select - dat = richmem_compress(SAMPLES[0], option, TRAINED_DICT) + with _check_deprecated(self): + dat = richmem_compress(SAMPLES[0], option, TRAINED_DICT) self.assertEqual(decompress(dat, TRAINED_DICT), SAMPLES[0]) # explicitly select - dat = richmem_compress(SAMPLES[0], option, TRAINED_DICT.as_digested_dict) + with _check_deprecated(self): + dat = richmem_compress(SAMPLES[0], option, TRAINED_DICT.as_digested_dict) self.assertEqual(decompress(dat, TRAINED_DICT), SAMPLES[0]) def test_len(self): @@ -2587,27 +2603,37 @@ ZstdFile(BytesIO(COMPRESSED_100_PLUS_32KB), zstd_dict=b'dict123456') def test_init_sizes_arg(self): - with ZstdFile(BytesIO(), 'r', read_size=1): - pass - with self.assertRaises(ValueError): - ZstdFile(BytesIO(), 'r', read_size=0) - with self.assertRaises(ValueError): - ZstdFile(BytesIO(), 'r', read_size=-1) - with self.assertRaises(TypeError): - ZstdFile(BytesIO(), 'r', read_size=(10,)) - with self.assertRaisesRegex(ValueError, 'read_size'): - ZstdFile(BytesIO(), 'w', read_size=10) + with _check_deprecated(self): + with ZstdFile(BytesIO(), 'r', read_size=1): + pass + with _check_deprecated(self): + with self.assertRaises(ValueError): + ZstdFile(BytesIO(), 'r', read_size=0) + with _check_deprecated(self): + with self.assertRaises(ValueError): + ZstdFile(BytesIO(), 'r', read_size=-1) + with _check_deprecated(self): + with self.assertRaises(TypeError): + ZstdFile(BytesIO(), 'r', read_size=(10,)) + with _check_deprecated(self): + with self.assertRaisesRegex(ValueError, 'read_size'): + ZstdFile(BytesIO(), 'w', read_size=10) - with ZstdFile(BytesIO(), 'w', write_size=1): - pass + with _check_deprecated(self): + with ZstdFile(BytesIO(), 'w', write_size=1): + pass with self.assertRaises(ValueError): - ZstdFile(BytesIO(), 'w', write_size=0) + with _check_deprecated(self): + ZstdFile(BytesIO(), 'w', write_size=0) with self.assertRaises(ValueError): - ZstdFile(BytesIO(), 'w', write_size=-1) + with _check_deprecated(self): + ZstdFile(BytesIO(), 'w', write_size=-1) with self.assertRaises(TypeError): - ZstdFile(BytesIO(), 'w', write_size=(10,)) + with _check_deprecated(self): + ZstdFile(BytesIO(), 'w', write_size=(10,)) with self.assertRaisesRegex(ValueError, 'write_size'): - ZstdFile(BytesIO(), 'r', write_size=10) + with _check_deprecated(self): + ZstdFile(BytesIO(), 'r', write_size=10) def test_init_close_fp(self): # get a temp file name @@ -2895,9 +2921,10 @@ self.assertEqual(f.read(), b"") self.assertTrue(f._buffer.raw._decomp.eof) - with ZstdFile(BytesIO(DAT_130K_C), - read_size=64*1024) as f: - self.assertEqual(f.read(), DAT_130K_D) + with _check_deprecated(self): + with ZstdFile(BytesIO(DAT_130K_C), + read_size=64*1024) as f: + self.assertEqual(f.read(), DAT_130K_D) with ZstdFile(BytesIO(COMPRESSED_100_PLUS_32KB), level_or_option={DParameter.windowLogMax:20}) as f: @@ -3134,10 +3161,11 @@ with BytesIO() as dst: option = {CParameter.compressionLevel:-5, CParameter.checksumFlag:1} - with ZstdFile(dst, "w", - level_or_option=option, - write_size=1024) as f: - f.write(THIS_FILE_BYTES) + with _check_deprecated(self): + with ZstdFile(dst, "w", + level_or_option=option, + write_size=1024) as f: + f.write(THIS_FILE_BYTES) comp = ZstdCompressor(option) expected = comp.compress(THIS_FILE_BYTES) + comp.flush() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyzstd-0.17.0/zstd/LICENSE new/pyzstd-0.18.0/zstd/LICENSE --- old/pyzstd-0.17.0/zstd/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/pyzstd-0.18.0/zstd/LICENSE 2025-10-05 09:02:21.000000000 +0200 @@ -0,0 +1,30 @@ +BSD License + +For Zstandard software + +Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name Facebook, nor Meta, nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
