From 11ce15f88a90704a78a8d8867da7356020f0d5b4 Mon Sep 17 00:00:00 2001 From: Rogdham Date: Sat, 3 Oct 2026 17:40:21 +0200 Subject: [PATCH 1/3] chore: update dev dependency: mypy --- CHANGELOG.md | 4 ++++ requirements-type.txt | 2 +- src/pyzstd/__init__.py | 10 +++++----- src/pyzstd/__main__.py | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 321d10c..c2268a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## Unreleased + +- Necessary code changes following dev dependency update: `mypy` + ## 0.19.1 (December 13, 2025) - Fix `SeekableZstdFile` write table entries on 32-bits architectures when there is a huge number of entries diff --git a/requirements-type.txt b/requirements-type.txt index 4f2bbba..f5d9ba5 100644 --- a/requirements-type.txt +++ b/requirements-type.txt @@ -1 +1 @@ -mypy==1.19.0 +mypy==2.4.0 diff --git a/src/pyzstd/__init__.py b/src/pyzstd/__init__.py index 4f94298..37fce65 100644 --- a/src/pyzstd/__init__.py +++ b/src/pyzstd/__init__.py @@ -703,7 +703,7 @@ def compress_stream( raise TypeError("output_stream argument should have a .write() method.") if read_size < 1: raise ValueError("read_size argument should be a positive number.") - callback = _create_callback(output_stream, callback) + callback_bytes = _create_callback(output_stream, callback) total_input = 0 total_output = 0 compressor = ZstdCompressor(level_or_option, zstd_dict) @@ -713,12 +713,12 @@ def compress_stream( total_input += len(data_in) data_out = compressor.compress(data_in) total_output += len(data_out) - callback(total_input, total_output, data_in, data_out) + callback_bytes(total_input, total_output, data_in, data_out) if not total_input: return total_input, total_output data_out = compressor.flush() total_output += len(data_out) - callback(total_input, total_output, b"", data_out) + callback_bytes(total_input, total_output, b"", data_out) return total_input, total_output @@ -768,7 +768,7 @@ def decompress_stream( raise ValueError( "read_size argument and write_size argument should be positive numbers." ) - callback = _create_callback(output_stream, callback) + callback_bytes = _create_callback(output_stream, callback) total_input = 0 total_output = 0 decompressor = EndlessZstdDecompressor(zstd_dict, option) @@ -782,7 +782,7 @@ def decompress_stream( total_input += len(data_in) data_out = decompressor.decompress(data_in, write_size) total_output += len(data_out) - callback(total_input, total_output, data_in, data_out) + callback_bytes(total_input, total_output, data_in, data_out) if not decompressor.at_frame_edge: raise ZstdError( "Decompression failed: zstd data ends in an incomplete frame," diff --git a/src/pyzstd/__main__.py b/src/pyzstd/__main__.py index 6f9acf7..0fff622 100644 --- a/src/pyzstd/__main__.py +++ b/src/pyzstd/__main__.py @@ -295,7 +295,7 @@ def tarfile_create(args: Args) -> None: None, fileobj=args.output, mode="w", options=option, zstd_dict=args.zd ) as f: f.add(args.tar_input_dir, basename) - uncompressed_size = f.fileobj.tell() # type: ignore[union-attr] + uncompressed_size = f.fileobj.tell() t2 = time() output_file_size = args.output.tell() @@ -352,7 +352,7 @@ def tarfile_extract(args: Args) -> None: None, fileobj=args.input, mode="r", zstd_dict=args.zd, options=option ) as f: f.extractall(args.tar_output_dir, filter="data") - uncompressed_size = f.fileobj.tell() # type: ignore[union-attr] + uncompressed_size = f.fileobj.tell() t2 = time() close_files(args) From d3a4559fefc728769dc0dba8f6a660548958bf9e Mon Sep 17 00:00:00 2001 From: Rogdham Date: Sat, 3 Oct 2026 17:47:33 +0200 Subject: [PATCH 2/3] chore: update dev dependency: ruff --- CHANGELOG.md | 2 +- docs/deprecated.md | 22 +++++++++++----------- pyproject.toml | 1 + requirements-lint.txt | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2268a9..16d5fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ## Unreleased -- Necessary code changes following dev dependency update: `mypy` +- Necessary code changes following dev dependency update: `mypy`, `ruff` ## 0.19.1 (December 13, 2025) diff --git a/docs/deprecated.md b/docs/deprecated.md index 73f3daa..49be91a 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -4,13 +4,13 @@ ```python # before -with io.open(input_file_path, 'rb') as ifh: - with io.open(output_file_path, 'wb') as ofh: +with io.open(input_file_path, "rb") as ifh: + with io.open(output_file_path, "wb") as ofh: compress_stream(ifh, ofh, level_or_option=5) # after -with io.open(input_file_path, 'rb') as ifh: - with pyzstd.open(output_file_path, 'w', level_or_option=5) as ofh: +with io.open(input_file_path, "rb") as ifh: + with pyzstd.open(output_file_path, "w", level_or_option=5) as ofh: shutil.copyfileobj(ifh, ofh) ``` @@ -23,8 +23,8 @@ Alternatively, you can use `ZstdCompressor` to have more control: ```python # after: more complex alternative -with io.open(input_file_path, 'rb') as ifh: - with io.open(output_file_path, 'wb') as ofh: +with io.open(input_file_path, "rb") as ifh: + with io.open(output_file_path, "wb") as ofh: compressor = ZstdCompressor(level_or_option=5) compressor._set_pledged_input_size(pledged_input_size) # optional while data := ifh.read(read_size): @@ -39,13 +39,13 @@ _Deprecated in version 0.17.0._ ```python # before -with io.open(input_file_path, 'rb') as ifh: - with io.open(output_file_path, 'wb') as ofh: +with io.open(input_file_path, "rb") as ifh: + with io.open(output_file_path, "wb") as ofh: decompress_stream(ifh, ofh) # after with pyzstd.open(input_file_path) as ifh: - with io.open(output_file_path, 'wb') as ofh: + with io.open(output_file_path, "wb") as ofh: shutil.copyfileobj(ifh, ofh) ``` @@ -58,8 +58,8 @@ Alternatively, you can use `EndlessZstdDecompressor` to have more control: ```python # after: more complex alternative -with io.open(input_file_path, 'rb') as ifh: - with io.open(output_file_path, 'wb') as ofh: +with io.open(input_file_path, "rb") as ifh: + with io.open(output_file_path, "wb") as ofh: decompressor = EndlessZstdDecompressor() while True: if decompressor.needs_input: diff --git a/pyproject.toml b/pyproject.toml index 021c8b7..0a09fd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,6 +116,7 @@ select = ["ALL"] ignore = [ "C901", "COM812", + "CPY001", "D", "E501", "EM", diff --git a/requirements-lint.txt b/requirements-lint.txt index ef96a1b..4e55a01 100644 --- a/requirements-lint.txt +++ b/requirements-lint.txt @@ -1 +1 @@ -ruff==0.14.8 +ruff==0.16.10 From 0f98d754687351a06a00b767fe693c87e8598f35 Mon Sep 17 00:00:00 2001 From: Rogdham Date: Sat, 3 Oct 2026 17:47:05 +0200 Subject: [PATCH 3/3] chore: update GitHub Actions dependencies --- .github/workflows/build.yml | 20 ++++++++++---------- .github/workflows/check.yml | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0a1a23..1e30cfc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,13 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # fetch all commits for version computation fetch-depth: 0 persist-credentials: false - name: Setup Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.14" - name: Install dependencies @@ -36,7 +36,7 @@ jobs: - name: List distributions run: ls -lR dist - name: Save build artifacts - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: build path: dist @@ -61,7 +61,7 @@ jobs: - "pypy-3.10" - "pypy-3.11" steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Restore build artifacts @@ -70,7 +70,7 @@ jobs: name: build path: dist - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python }} - name: Install wheel @@ -82,11 +82,11 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.14 - name: Install dependencies @@ -100,11 +100,11 @@ jobs: name: Type runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Setup Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: 3.14 - name: Install dependencies @@ -133,7 +133,7 @@ jobs: - name: List distributions run: ls -lR dist - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 with: verbose: true print-hash: true diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 253be74..bb2aef5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,10 +13,10 @@ jobs: zizmor: runs-on: ubuntu-latest steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: zizmor - uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3 + uses: zizmorcore/zizmor-action@cc914d7f3750a2d13d75c7f184a1060aa0e9d482 # v0.6.4 with: advanced-security: false