Skip to content

Commit 5db8590

Browse files
committed
Add gzip_ng_threaded to documentation
1 parent 508c5b7 commit 5db8590

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Changelog
99
1010
version 0.4.0-dev
1111
-----------------
12+
+ Add a ``gzip_ng_threaded`` module that contains the ``gzip_ng_threaded.open``
13+
function. This allows using multithreaded compression as well as escaping the
14+
GIL.
1215
+ The internal ``gzip_ng._GzipReader`` has been rewritten in C. As a result the
1316
overhead of decompressing files has significantly been reduced.
1417
+ The ``gzip_ng._GzipReader`` in C is now used in ``gzip_ng.decompress``. The

README.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ by providing Python bindings for the zlib-ng library.
4242
This package provides Python bindings for the `zlib-ng
4343
<https://github.com/zlib-ng/zlib-ng>`_ library.
4444

45-
``python-zlib-ng`` provides the bindings by offering two modules:
45+
``python-zlib-ng`` provides the bindings by offering three modules:
4646

4747
+ ``zlib_ng``: A drop-in replacement for the zlib module that uses zlib-ng to
4848
accelerate its performance.
@@ -51,6 +51,11 @@ This package provides Python bindings for the `zlib-ng
5151
instead of ``zlib`` to perform its compression and checksum tasks, which
5252
improves performance.
5353

54+
+ ``gzip_ng_threaded`` offers an ``open`` function which returns buffered read
55+
or write streams that can be used to read and write large files while
56+
escaping the GIL using one or multiple threads. This functionality only
57+
works for streaming, seeking is not supported.
58+
5459
``zlib_ng`` and ``gzip_ng`` are almost fully compatible with ``zlib`` and
5560
``gzip`` from the Python standard library. There are some minor differences
5661
see: differences-with-zlib-and-gzip-modules_.
@@ -68,6 +73,7 @@ The python-zlib-ng modules can be imported as follows
6873
6974
from zlib_ng import zlib_ng
7075
from zlib_ng import gzip_ng
76+
from zlib_ng import gzip_ng_threaded
7177
7278
``zlib_ng`` and ``gzip_ng`` are meant to be used as drop in replacements so
7379
their api and functions are the same as the stdlib's modules.

docs/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ API-documentation: zlib_ng.gzip_ng
113113
:members:
114114
:special-members: __init__
115115

116+
===========================================
117+
API-documentation: zlib_ng.gzip_ng_threaded
118+
===========================================
119+
120+
.. automodule:: zlib_ng.gzip_ng_threaded
121+
:members: open
122+
116123
===============================
117124
python -m zlib_ng.gzip_ng usage
118125
===============================

src/zlib_ng/gzip_ng_threaded.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
33
# Python Software Foundation; All Rights Reserved
44

5-
# This file is part of python-isal which is distributed under the
5+
# This file is part of python-zlib-ng which is distributed under the
66
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
77

88
import builtins
@@ -27,7 +27,7 @@ def open(filename, mode="rb", compresslevel=gzip_ng._COMPRESS_LEVEL_TRADEOFF,
2727
Comparable to gzip.open. This method is only usable for streamed reading
2828
and writing of objects. Seeking is not supported.
2929
30-
threads == 0 will defer to igzip.open. A threads < 0 will attempt to use
30+
threads == 0 will defer to gzip_ng.open. A threads < 0 will attempt to use
3131
the number of threads in the system.
3232
3333
:param filename: str, bytes or file-like object (supporting read or write
@@ -37,7 +37,7 @@ def open(filename, mode="rb", compresslevel=gzip_ng._COMPRESS_LEVEL_TRADEOFF,
3737
:param encoding: Passed through to the io.TextIOWrapper, if applicable.
3838
:param errors: Passed through to the io.TextIOWrapper, if applicable.
3939
:param newline: Passed through to the io.TextIOWrapper, if applicable.
40-
:param threads: If 0 will defer to igzip.open, if < 0 will use all threads
40+
:param threads: If 0 will defer to gzip_ng.open, if < 0 will use all threads
4141
available to the system. Reading gzip can only
4242
use one thread.
4343
:param block_size: Determines how large the blocks in the read/write

0 commit comments

Comments
 (0)