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
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`, `ruff`

## 0.19.1 (December 13, 2025)

- Fix `SeekableZstdFile` write table entries on 32-bits architectures when there is a huge number of entries
Expand Down
22 changes: 11 additions & 11 deletions docs/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand All @@ -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):
Expand All @@ -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)
```

Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ select = ["ALL"]
ignore = [
"C901",
"COM812",
"CPY001",
"D",
"E501",
"EM",
Expand Down
2 changes: 1 addition & 1 deletion requirements-lint.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.14.8
ruff==0.16.10
2 changes: 1 addition & 1 deletion requirements-type.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mypy==1.19.0
mypy==2.4.0
10 changes: 5 additions & 5 deletions src/pyzstd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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


Expand Down Expand Up @@ -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)
Expand All @@ -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,"
Expand Down
4 changes: 2 additions & 2 deletions src/pyzstd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
Loading