Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
76555bb
Remove requirement to update version manually from release checklist.
rhpvorderman Sep 25, 2024
0b329ff
Add address sanitizer check to release checklist
rhpvorderman Sep 25, 2024
9948848
Merge branch 'main' into develop
rhpvorderman Sep 25, 2024
c124fca
Merge branch 'main' into develop
rhpvorderman Sep 25, 2024
3cdb2e3
Merge branch 'main' into develop
rhpvorderman Sep 25, 2024
fe3ccbb
Merge branch 'main' into develop
rhpvorderman Sep 25, 2024
dbfdf8a
Switch to setuptools-scm setup
rhpvorderman May 27, 2025
845125e
Use optimized build flags rather than appended flags because of setup…
rhpvorderman May 27, 2025
a189a3d
Add setuptools-scm change to CHANGELOG
rhpvorderman May 27, 2025
4912a4c
Add test files to the source distribution
rhpvorderman May 27, 2025
54f8595
Fix documentation build.
rhpvorderman May 27, 2025
5bb8918
Merge pull request #64 from pycompression/setuptools_scm
rhpvorderman May 27, 2025
6f68be9
Enable Python 3.14 support, disable Python 3.9
rhpvorderman Sep 9, 2025
a9f525f
Update git checkouts for actions
rhpvorderman Sep 9, 2025
4f7a683
Merge pull request #65 from pycompression/314
rhpvorderman Sep 9, 2025
454a452
Add a test for correctly flushing data to disk
rhpvorderman Sep 9, 2025
175df5b
Fix flushing behavior for gzip_ng_threaded
rhpvorderman Sep 9, 2025
a8e91fb
Merge pull request #66 from pycompression/fixflushing
rhpvorderman Sep 10, 2025
3e393e0
Update asan environment to better show errors
rhpvorderman Sep 9, 2025
67fe5ce
Fix an issue where some tests failed because they ignored PYTHONPATH
rhpvorderman Sep 10, 2025
402d8c9
Fix improper URL for readthedocs
rhpvorderman Sep 10, 2025
faea9dc
Merge pull request #67 from pycompression/fixasan
rhpvorderman Sep 10, 2025
0baca00
Prepare release 1.0.0
rhpvorderman Sep 10, 2025
5d4d68b
Run on latest macos
rhpvorderman Sep 10, 2025
2a3d6bf
Update bundled zlib-ng to 2.2.5
rhpvorderman Sep 10, 2025
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
2 changes: 1 addition & 1 deletion .github/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ Release checklist
- [ ] Check [latest documentation](https://python-zlib-ng.readthedocs.io/en/latest/) looks fine.
- [ ] Create a release branch.
- [ ] Change current development version in `CHANGELOG.rst` to stable version.
- [ ] Check if the address sanitizer does not find any problems using `tox -e asan`
- [ ] Merge the release branch into `main`.
- [ ] Created an annotated tag with the stable version number. Include changes
from CHANGELOG.rst.
- [ ] Push tag to remote. This triggers the wheel/sdist build on github CI.
- [ ] merge `main` branch back into `develop`.
- [ ] Add updated version number to develop. (`setup.py` and `src/zlib_ng/__init__.py`)
- [ ] Build the new tag on readthedocs. Only build the last patch version of
each minor version. So `1.1.1` and `1.2.0` but not `1.1.0`, `1.1.1` and `1.2.0`.
- [ ] Create a new release on github.
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/setup-python@v2.2.1
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.10"
- name: Install tox
run: pip install tox
- name: Lint
Expand All @@ -39,10 +39,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.8
uses: actions/setup-python@v2.2.1
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.10"
- name: Install tox and upgrade setuptools and pip
run: pip install --upgrade tox setuptools pip
- name: Run tox -e ${{ matrix.tox_env }}
Expand All @@ -53,34 +53,34 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "pypy-3.9"
- "3.13"
- "3.14"
- "pypy-3.10"
- "pypy-3.11"
os: ["ubuntu-latest"]
include:
- os: "macos-14" # For m1 macos
- os: "macos-latest" # For m1 macos
python-version: "3.12"
- os: "macos-13" # for x86 macos
python-version: "3.8"
python-version: "3.10"
- os: "windows-latest"
python-version: "3.8"
python-version: "3.10"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.2.1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install tox and upgrade setuptools
run: pip install --upgrade tox setuptools
- name: Set MSVC developer prompt
uses: ilammy/msvc-dev-cmd@v1.6.0
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Install build dependencies (MacOS)
run: brew install make
Expand All @@ -96,12 +96,12 @@ jobs:
strategy:
matrix:
python_version:
- "3.8"
- "3.10"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: uraimo/run-on-arch-action@v2.5.0
- uses: uraimo/run-on-arch-action@v3
name: Build & run test
with:
arch: none
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
os:
- "ubuntu-latest"
- "macos-13"
- "macos-14"
- "macos-latest"
- "windows-latest"
python_version: [ "python" ]
include:
Expand All @@ -146,7 +146,7 @@ jobs:
- name: Install requirements (universal)
run: conda install zlib-ng ${{ matrix.python_version}} tox
- name: Set MSVC developer prompt
uses: ilammy/msvc-dev-cmd@v1.6.0
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Run tests (dynamic link)
run: tox
Expand All @@ -167,7 +167,7 @@ jobs:
os:
- ubuntu-latest
- macos-13
- macos-14
- macos-latest
- windows-latest
cibw_archs_linux: ["x86_64"]
build_sdist: [true]
Expand All @@ -179,25 +179,25 @@ jobs:
with:
submodules: recursive
fetch-depth: 0 # Fetch everything to get accurately versioned tag.
- uses: actions/setup-python@v2
- uses: actions/setup-python@v2 # Some issues where caused by higher versions.
name: Install Python
- name: Install cibuildwheel twine build
run: python -m pip install cibuildwheel twine build
- name: Install build dependencies (Macos)
run: brew install make
if: runner.os == 'macOS'
- name: Set MSVC developer prompt
uses: ilammy/msvc-dev-cmd@v1.6.0
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- name: Set up QEMU
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'aarch64'}}
uses: docker/setup-qemu-action@v1.0.1
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build wheels
run: cibuildwheel --output-dir dist
env:
# Skip 32 bit, macosx_arm64 causes issues on cpython 3.8
# Skip 32 bit, macosx_arm64 causes issues on cpython 3.9
CIBW_SKIP: "*-win32 *-manylinux_i686 cp38-macosx_arm64"
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }}
CIBW_TEST_REQUIRES: "pytest"
Expand All @@ -218,14 +218,14 @@ jobs:
CIBW_ENVIRONMENT_LINUX: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=/tmp/build_cache
CFLAGS="-g0 -DNDEBUG"
CFLAGS="-O3 -DNDEBUG"
CIBW_ENVIRONMENT_WINDOWS: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}\build_cache
CIBW_ENVIRONMENT_MACOS: >-
PYTHON_ZLIB_NG_BUILD_CACHE=True
PYTHON_ZLIB_NG_BUILD_CACHE_FILE=${{ runner.temp }}/build_cache
CFLAGS="-g0 -DNDEBUG"
CFLAGS="-O3 -DNDEBUG"
- name: Build sdist
if: ${{runner.os == 'Linux' && matrix.cibw_archs_linux == 'x86_64'}}
run:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ Changelog
.. This document is user facing. Please word the changes in such a way
.. that users understand how the changes affect the new version.

version 1.0.0
-----------------
The library has been running without issues as a dependency in quite a few
projects and is now stable enough for the first major version.

+ Updated bundled zlib-ng to 2.2.5.
+ Python 3.14 is supported.
+ Python 3.8 and 3.9 are no longer supported.
+ Fix an issue where flushing using igzip_threaded caused a gzip end of stream
and started a new gzip stream. In essence creating a concatenated gzip
stream. Now it is in concordance with how single threaded gzip streams
are flushed using Z_SYNC_FLUSH.
+ Switched to setuptools-scm for building the package rather than versioningit.
+ Test files are added to the source distribution.
+ Fix an issue where some tests failed because they ignored PYTHONPATH.

version 0.5.1
-----------------
+ Fix a bug where flushing in threaded mode did not write the data to the
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
graft src/zlib_ng/zlib-ng
prune tests
prune docs
prune benchmark_scripts
prune .github
exclude tox.ini
exclude requirements-docs.txt
exclude codecov.yml
exclude .readthedocs.yml
Expand Down
3 changes: 0 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme_options = dict(
display_version=True,
)

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
60 changes: 54 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,58 @@
[build-system]
requires = ["setuptools>=64", "versioningit>=1.1.0"]
requires = ["setuptools>=77", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.versioningit.vcs]
method="git"
default-tag = "v0.0.0"
[project]
name = "zlib-ng"
dynamic = ["version"]
description = "Drop-in replacement for zlib and gzip modules using zlib-ng"
license="PSF-2.0"
keywords=["zlib-ng", "zlib", "compression", "deflate", "gzip"]
authors = [{name = "Leiden University Medical Center"},
{email = "r.h.p.vorderman@lumc.nl"}]
readme = "README.rst"
requires-python = ">=3.9" # Because of setuptools version
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Development Status :: 5 - Production/Stable",
"Topic :: System :: Archiving :: Compression",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
]
urls.homepage = "https://github.com/pycompression/python-zlib-ng"
urls.documentation = "https://python-zlib-ng.readthedocs.io"

[tool.versioningit.write]
file = "src/zlib_ng/_version.py"
[tool.setuptools_scm]
version_file = "src/zlib_ng/_version.py"

[tool.setuptools.packages.find]
where = ["src"]
include = ["zlib_ng"]

[tool.setuptools.package-data]
zlib_ng = ['*.pyi', 'py.typed', 'zlib-ng/LICENSE', 'zlib-ng/README.md']
[tool.setuptools.exclude-package-data]
zlib_ng = [
"*.c",
"*.h",
"zlib-ng/*/*",
"zlib-ng/*in",
"zlib-ng/.*",
"zlib-ng/*.map",
"zlib-ng/INDEX.md",
"zlib-ng/CMakeLists.txt",
"zlib-ng/PORTING.md",
"zlib-ng/configure",
"zlib-ng/*.empty",
"zlib-ng/FAQ.zlib",
]
4 changes: 2 additions & 2 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx
setuptools
# https://github.com/sphinx-doc/sphinx/issues/13415
sphinx<8
sphinx-rtd-theme
sphinx-argparse
41 changes: 1 addition & 40 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
import tempfile
from pathlib import Path

from setuptools import Extension, find_packages, setup
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext

import versioningit

ZLIB_NG_SOURCE = os.path.join("src", "zlib_ng", "zlib-ng")

SYSTEM_IS_UNIX = (sys.platform.startswith("linux") or
Expand Down Expand Up @@ -125,43 +123,6 @@ def build_zlib_ng():


setup(
name="zlib-ng",
version=versioningit.get_version(),
description="Drop-in replacement for zlib and gzip modules using zlib-ng",
author="Leiden University Medical Center",
author_email="r.h.p.vorderman@lumc.nl", # A placeholder for now
long_description=Path("README.rst").read_text(),
long_description_content_type="text/x-rst",
cmdclass={"build_ext": BuildZlibNGExt},
license="PSF-2.0",
keywords="zlib-ng zlib compression deflate gzip",
zip_safe=False,
packages=find_packages('src'),
package_dir={'': 'src'},
package_data={'zlib_ng': [
'*.pyi', 'py.typed',
# Include zlib-ng LICENSE and other relevant files with the binary distribution.
'zlib-ng/LICENSE.md', 'zlib-ng/README.md']},
url="https://github.com/pycompression/python-zlib-ng",
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: C",
"Development Status :: 4 - Beta",
"Topic :: System :: Archiving :: Compression",
"License :: OSI Approved :: Python Software Foundation License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
],
python_requires=">=3.8", # Earliest version still tested.
ext_modules=EXTENSIONS
)
17 changes: 6 additions & 11 deletions src/zlib_ng/gzip_ng_threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,30 +321,25 @@ def write(self, b) -> int:
self.input_queues[worker_index].put((data, zdict))
return len(data)

def _end_gzip_stream(self):
def flush(self):
self._check_closed()
# Wait for all data to be compressed
for in_q in self.input_queues:
in_q.join()
# Wait for all data to be written
for out_q in self.output_queues:
out_q.join()
# Write an empty deflate block with a lost block marker.
self.raw.flush()

def close(self):
if self._closed:
return
self.raw.write(zlib_ng.compress(b"", wbits=-15))
trailer = struct.pack("<II", self._crc, self._size & 0xFFFFFFFF)
self.raw.write(trailer)
self._crc = 0
self._size = 0
self.raw.flush()

def flush(self):
self._end_gzip_stream()
self._write_gzip_header()

def close(self) -> None:
if self._closed:
return
self._end_gzip_stream()
self.stop()
if self.exception:
self.raw.close()
Expand Down
2 changes: 1 addition & 1 deletion src/zlib_ng/zlib-ng
Submodule zlib-ng updated 216 files
Loading
Loading