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
263 changes: 54 additions & 209 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,243 +11,88 @@ on:
workflow_dispatch:

env:
PYTHON_VER: "3.11" # Python to run test/cibuildwheel
CIBW_BUILD: >
cp310-* cp311-* cp312-* cp313-* cp313t-* cp314-* cp314t-*
pp310-* pp311-*
CIBW_ENABLE: cpython-freethreading pypy pypy-eol
CIBW_TEST_COMMAND: python -m unittest discover {project}/tests
PY_COLORS: 1

jobs:
test_cpython:
name: Test on ${{ matrix.platform }} ${{ matrix.architecture }} ${{ matrix.build_option }}
runs-on: ${{ matrix.platform }}

strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
build_option:
- "--warning-as-error"
- "--warning-as-error --multi-phase-init"
- "--warning-as-error --cffi"
architecture:
- x64
include:
- platform: windows-latest
build_option: "--warning-as-error"
architecture: x86
- platform: windows-latest
build_option: "--warning-as-error --multi-phase-init"
architecture: x86
- platform: windows-latest
build_option: "--warning-as-error --cffi"
architecture: x86

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}
architecture: ${{ matrix.architecture }}

- name: Run test
run: |
python -m pip install cffi
python -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv .
python -m unittest discover tests

test_cpython_debug:
name: Test debug build on Ubuntu ${{ matrix.build_option }}
runs-on: ubuntu-latest

strategy:
matrix:
build_option:
- "--warning-as-error --debug"
- "--warning-as-error --debug --multi-phase-init"

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Run test
run: |
sudo apt-get update
sudo apt-get install python3-dbg
python3-dbg -m pip install --config-settings="--build-option=${{ matrix.build_option }}" -vv .
python3-dbg -m unittest discover tests

test_pypy:
name: Test on ${{ matrix.py }}
runs-on: ubuntu-latest

strategy:
matrix:
py:
- "pypy-3.10"
- "pypy-3.11"

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}

- name: Build & test
run: |
sudo apt-get install -q -y zstd libzstd1 libzstd-dev
python -m pip install --config-settings="--build-option=--dynamic-link-zstd --warning-as-error" -v .
python -m unittest discover tests

build_sdist:
name: Build sdist
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch'
build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}

- name: Build sdist
run: |
python -m pip install -U build
python -m build --sdist

- uses: actions/checkout@v6
with:
# fetch all commits for version computation
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: Install dependencies
run: python -m pip install -U build
- name: Build
run: python -m build
- name: List distributions
run: ls -lR dist

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheels on ${{ matrix.platform }}
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch'
runs-on: ${{ matrix.platform }}

strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
- windows-latest
- windows-11-arm

env:
CIBW_ARCHS_MACOS: "x86_64 arm64"

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}

- name: Build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse

- name: List distributions
run: ls -lR wheelhouse
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v4
- name: Save build artifacts
uses: actions/upload-artifact@v5
with:
name: cibw-wheels-${{ matrix.platform }}
path: wheelhouse/*.whl
name: build
path: dist
- name: Install sdist
run: python -m pip install dist/*.tar.gz
- name: Test
run: python -m unittest discover tests -v

build_arch_wheels:
name: Build wheels for ${{ matrix.arch }} (skip ${{ matrix.skip_image }})
if: startsWith(github.ref, 'refs/tags') || startsWith(github.head_ref, 'release-') || github.event_name == 'workflow_dispatch'
tests-py:
name: Test | ${{ matrix.python }}
runs-on: ubuntu-latest

needs:
- build
strategy:
matrix:
arch:
- aarch64
- ppc64le
- s390x
# Building in QEMU is very slow, so parallelize the tasks.
skip_image:
- musllinux
- manylinux

env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: "*${{ matrix.skip_image }}*"

python:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy-3.10"
- "pypy-3.11"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Restore build artifacts
uses: actions/download-artifact@v6
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VER }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Build wheels
run: |
python -m pip install -U cibuildwheel
python -m cibuildwheel --output-dir wheelhouse

- name: List distributions
run: ls -lR wheelhouse

- name: Upload wheels
uses: actions/upload-artifact@v4
name: build
path: dist
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v6
with:
name: cibw-wheels-${{ matrix.arch }}-${{ matrix.skip_image }}
path: wheelhouse/*.whl
python-version: ${{ matrix.python }}
- name: Install wheel
run: python -m pip install dist/*.whl
- name: Test
run: python -m unittest discover tests -v

upload_pypi:
publish:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
needs:
- build_sdist
- build_wheels
- build_arch_wheels
- build
- tests-py
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write # This permission is mandatory for trusted publishing

steps:
- name: Download wheels
uses: actions/download-artifact@v4
- name: Restore build artifacts
uses: actions/download-artifact@v6
with:
pattern: cibw-*
name: build
path: dist
merge-multiple: true

- name: List distributions
run: ls -lR dist

- name: Upload to PyPI
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
print-hash: true
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/.vscode
/env
__pycache__

/build
/dist

__pycache__
*.o
*.pdb
*.so
*.egg-info
/.eggs

/.vscode

/LICENSE_zstd
/src/pyzstd/_version.py
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ All notable changes to this project will be documented in this file.

## Unreleased

- The project has been completely refactored to use the Zstandard implementation from the standard library ([PEP-784](https://peps.python.org/pep-0784/))
- The refactor has some minor impact on public APIs, such as changing the exception raised on invalid input
- Add `backports.zstd` dependency for Python before 3.14
- Changes in build dependency: remove `setuptools` and C build toolchain, add `hatchling` and `hatch-vcs`
- Remove git submodule usage
- Drop support for Python 3.9 and below
- Build free-threaded wheels for CPython 3.13 and 3.14, even if the feature is not supported
- Refactor SeekableZstdFile to make it independent of ZstdFile

## 0.18.0 (October 5, 2025)

Expand Down
13 changes: 0 additions & 13 deletions MANIFEST.in

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ an API style similar to the `bz2`, `lzma`, and `zlib` modules.
> We recommend new projects to use the standard library, and existing ones to consider
> migrating.
>
> `pyzstd` internally uses `compression.zstd` since version 0.19.0.
>
> See [`pyzstd`'s documentation][doc] for details and a migration guide.

[doc]: https://pyzstd.readthedocs.io/
Expand Down
Loading