Skip to content

Commit a6ea21d

Browse files
committed
Merge remote-tracking branch 'remotes/origin/develop' into windows
# Conflicts: # .github/workflows/ci.yml
2 parents f517114 + 76726d8 commit a6ea21d

17 files changed

+462
-144
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- develop
88
- main
9+
tags:
10+
- "*"
911

1012

1113
jobs:
@@ -42,6 +44,54 @@ jobs:
4244
run: tox -e docs
4345
env:
4446
PYTHON_ISAL_LINK_DYNAMIC: True
47+
mypy:
48+
needs: lint
49+
runs-on: ubuntu-20.04
50+
steps:
51+
- uses: actions/[email protected]
52+
with:
53+
submodules: recursive
54+
- name: Set up Python 3.6
55+
uses: actions/[email protected]
56+
with:
57+
python-version: 3.6
58+
- name: Install isal
59+
run: sudo apt-get install libisal-dev
60+
- name: Install tox and upgrade setuptools and pip
61+
run: pip install --upgrade tox setuptools pip
62+
- name: Mypy checks
63+
run: tox -e mypy
64+
env:
65+
PYTHON_ISAL_LINK_DYNAMIC: True
66+
twine_check:
67+
needs: lint
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
matrix:
71+
python-version:
72+
- 3.6
73+
os: ["ubuntu-latest" ]
74+
steps:
75+
- uses: actions/[email protected]
76+
with:
77+
submodules: recursive
78+
- name: Set up Python ${{ matrix.python-version }}
79+
uses: actions/[email protected]
80+
with:
81+
python-version: ${{ matrix.python-version }}
82+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
83+
run: sudo apt install yasm
84+
if: runner.os == 'Linux'
85+
- name: Install build dependencies (Macos)
86+
run: brew install yasm automake autoconf
87+
if: runner.os == 'macOS'
88+
- name: Install twine, cython wheel and upgrade setuptools
89+
run: pip install --upgrade twine cython wheel setuptools
90+
- name: create dists
91+
run: python setup.py sdist bdist_wheel
92+
- name: check dists
93+
run: twine check dist/*
94+
4595
test-static:
4696
needs: lint
4797
runs-on: ${{ matrix.os }}
@@ -52,7 +102,10 @@ jobs:
52102
- 3.7
53103
- 3.8
54104
- 3.9
55-
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
105+
os: ["ubuntu-latest"]
106+
include:
107+
- os: "macos-latest"
108+
python-version: 3.8
56109
steps:
57110
- uses: actions/[email protected]
58111
with:
@@ -69,9 +122,6 @@ jobs:
69122
- name: Install build dependencies (Macos)
70123
run: brew install yasm automake autoconf
71124
if: runner.os == 'macOS'
72-
- name: Install build dependencies (Windows)
73-
run: choco install yasm
74-
if: runner.os == 'Windows'
75125
- name: Run tests
76126
run: tox -e py3
77127
- name: Upload coverage report
@@ -84,9 +134,6 @@ jobs:
84134
matrix:
85135
python-version:
86136
- 3.6
87-
- 3.7
88-
- 3.8
89-
- 3.9
90137
os: ["ubuntu-20.04"]
91138
steps:
92139
- uses: actions/[email protected]
@@ -100,8 +147,52 @@ jobs:
100147
run: sudo apt-get install libisal-dev
101148
- name: Install tox and upgrade setuptools and pip
102149
run: pip install --upgrade tox setuptools pip
103-
104150
- name: Run tests (dynamic link)
105151
run: tox -e py3
106152
env:
107153
PYTHON_ISAL_LINK_DYNAMIC: True
154+
155+
deploy:
156+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
157+
runs-on: ${{ matrix.os }}
158+
needs: [lint, docs, test-static, test-dynamic, twine_check]
159+
strategy:
160+
matrix:
161+
os: [ "macos-latest", "ubuntu-latest" ]
162+
steps:
163+
- uses: actions/[email protected]
164+
with:
165+
submodules: recursive
166+
- uses: actions/setup-python@v2
167+
name: Install Python
168+
- name: Install cibuildwheel twine
169+
run: python -m pip install cibuildwheel twine
170+
- name: Install build dependencies (Macos)
171+
run: brew install yasm automake autoconf
172+
if: runner.os == 'macOS'
173+
- name: Build wheels
174+
run: cibuildwheel --output-dir dist
175+
env:
176+
CIBW_BUILD: "cp3{6,7,8,9}-*"
177+
CIBW_SKIP: "*-win32 *-manylinux_i686" # Skip 32 bit.
178+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
179+
# Below command fails when data is not correctly statically linked
180+
# Full tests not needed: these are done prior to building.
181+
CIBW_TEST_COMMAND: "python -c 'from isal import isal_zlib, igzip; isal_zlib.adler32(b\"bla\")'"
182+
- name: Build sdist
183+
if: "runner.os == 'Linux'"
184+
run: python setup.py sdist
185+
- name: Publish package to TestPyPI
186+
# pypa/gh-action-pypi-publish@master does not work on OSX
187+
# Alpha, Beta and dev releases contain a - in the tag.
188+
if: contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
189+
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
190+
env:
191+
TWINE_USERNAME: __token__
192+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
193+
- name: Publish package to PyPI
194+
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
195+
run: twine upload dist/*
196+
env:
197+
TWINE_USERNAME: __token__
198+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,23 @@ Changelog
77
.. This document is user facing. Please word the changes in such a way
88
.. that users understand how the changes affect the new version.
99
10-
version 0.3.1-dev
10+
version 0.5.0
1111
-----------------
12+
+ Fix a bug where negative integers were not allowed for the ``adler32`` and
13+
``crc32`` functions in ``isal_zlib``.
14+
+ Provided stubs (type-hint files) for ``isal_zlib`` and ``_isal`` modules.
15+
Package is now tested with mypy to ensure correct type information.
16+
+ The command-line interface now reads in blocks of 32K instead of 8K. This
17+
improves performance by about 6% when compressing and 11% when decompressing.
18+
A hidden ``-b`` flag was added to adjust the buffer size for benchmarks.
19+
+ A ``-c`` or ``--stdout`` flag was added to the CLI interface of isal.igzip.
20+
This allows it to behave more like the ``gzip`` or ``pigz`` command line
21+
interfaces.
22+
23+
version 0.4.0
24+
-----------------
25+
+ Move wheel building to cibuildwheel on github actions CI. Wheels are now
26+
provided for Mac OS as well.
1227
+ Make a tiny change in setup.py so python-isal can be build on Mac OS X.
1328

1429
version 0.3.0

README.rst

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,48 @@ a variety of functions to provide zlib/gzip-compatible compression.
4343
``igzip`` module which are usable as drop-in replacements for the ``zlib``
4444
and ``gzip`` modules from the stdlib (with some minor exceptions, see below).
4545

46+
Usage
47+
-----
48+
49+
Python-isal has faster versions of the stdlib's ``zlib`` and ``gzip`` module
50+
these are called ``isal_zlib`` and ``igzip`` respectively.
51+
52+
They can be imported as follows
53+
54+
.. code-block:: python
55+
56+
from isal import isal_zlib
57+
from isal import igzip
58+
59+
``isal_zlib`` and ``igzip`` are meant to be used as drop in replacements so
60+
their api and functions are the same as the stdlib's modules. Except where
61+
isa-l does not support the same calls as zlib (See differences below).
62+
63+
A full API documentation can be found on `our readthedocs page
64+
<https://python-isal.readthedocs.io>`_.
65+
66+
``python -m isal.igzip`` implements a simple gzip-like command line
67+
application (just like ``python -m gzip``).
68+
4669
Installation
4770
------------
4871
Installation with pip
4972
.....................
5073

51-
+ Linux: ``pip install isal``. Wheels are provided, so installation should
74+
+ Linux and MacOS: ``pip install isal``. Wheels are provided, so installation should
5275
be almost instantaneous.
53-
+ MacOS: make sure ``gcc``, ``yasm``, ``automake`` and ``autoconf`` packages
54-
are installed. These can be installed via `Homebrew <https://brew.sh/>`_ with
55-
``brew install gcc yasm automake autoconf``. Then proceed with ``pip
56-
install isal``. The package will be build on your computer.
5776
+ Windows: Installation is not supported yet.
5877

59-
The installation will include a staticallly linked version of isa-l. On Linux,
60-
wheels are provided. If a wheel is not provided for your system the
78+
The installation will include a staticallly linked version of isa-l. On Linux
79+
and MacOS, wheels are provided. If a wheel is not provided for your system the
6180
installation will build ISA-L first in a temporary directory. Please check the
6281
`ISA-L homepage <https://github.com/intel/isa-l>`_ for the build requirements.
6382

6483
The latest development version of python-isal can be installed with::
6584

6685
pip install git+https://github.com/rhpvorderman/python-isal.git
6786

87+
This requires having the build requirements installed.
6888
If you wish to link
6989
dynamically against a version of libisal installed on your system use::
7090

@@ -102,39 +122,13 @@ python-isal is available on conda-forge and can be installed with
102122
This will automatically install the isa-l library dependency as well, since
103123
it is available on conda-forge.
104124

105-
106-
Usage
107-
-----
108-
109-
Python-isal has faster versions of the stdlib's ``zlib`` and ``gzip`` module
110-
these are called ``isal_zlib`` and ``igzip`` respectively.
111-
112-
They can be imported as follows
113-
114-
.. code-block:: python
115-
116-
from isal import isal_zlib
117-
from isal import igzip
118-
119-
``isal_zlib`` and ``igzip`` were meant to be used as drop in replacements so
120-
their api and functions are the same as the stdlib's modules. Except where
121-
isa-l does not support the same calls as zlib (See differences below).
122-
123-
A full API documentation can be found on `our readthedocs page
124-
<https://python-isal.readthedocs.io>`_.
125-
126-
``python -m isal.igzip`` implements a simple gzip-like command line
127-
application (just like ``python -m gzip``).
128-
129125
Differences with zlib and gzip modules
130126
--------------------------------------
131127

132128
+ Compression level 0 in ``zlib`` and ``gzip`` means **no compression**, while
133129
in ``isal_zlib`` and ``igzip`` this is the **lowest compression level**.
134130
This is a design choice that was inherited from the ISA-L library.
135131
+ Compression levels range from 0 to 3, not 1 to 9.
136-
+ ``isal_zlib.crc32`` and ``isal_zlib.adler32`` do not support negative
137-
numbers for the value parameter.
138132
+ ``zlib.Z_DEFAULT_STRATEGY``, ``zlib.Z_RLE`` etc. are exposed as
139133
``isal_zlib.Z_DEFAULT_STRATEGY``, ``isal_zlib.Z_RLE`` etc. for compatibility
140134
reasons. However, ``isal_zlib`` only supports a default strategy and will
@@ -143,13 +137,14 @@ Differences with zlib and gzip modules
143137
``isal_zlib`` supports memory levels smallest, small, medium, large and
144138
largest. These have been mapped to levels 1, 2-3, 4-6, 7-8 and 9. So
145139
``isal_zlib`` can be used with zlib compatible memory levels.
146-
+ ``isal_zlib`` only supports ``FLUSH``, ``SYNC_FLUSH`` and ``FULL_FLUSH``
147-
``FINISH`` is aliased to ``FULL_FLUSH`` (and works correctly as such).
148140
+ ``isal_zlib`` has a ``compressobj`` and ``decompressobj`` implementation.
149141
However, the unused_data and unconsumed_tail for the Decompress object, only
150142
work properly when using gzip compatible compression. (25 <= wbits <= 31).
151143
+ The flush implementation for the Compress object behavious differently from
152-
the zlib equivalent.
144+
the zlib equivalent. The flush implementation is sufficient for
145+
the ``igzip`` module to work 100% in compliance with the ``gzip`` tests from
146+
CPython. It does not however work for all the ``zlib`` compliance tests
147+
(see above). This is an area that still needs work.
153148

154149
Contributing
155150
------------

buildwheels.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
comment: off
2+
coverage:
3+
status:
4+
project:
5+
default:
6+
target: 90 # let's try to hit high standards
7+
patch:
8+
default:
9+
target: 90 # Tests should be written for new features

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def build_isa_l():
128128

129129
setup(
130130
name="isal",
131-
version="0.4.0-dev",
131+
version="0.6.0-dev",
132132
description="Faster zlib and gzip compatible compression and "
133133
"decompression by providing python bindings for the isa-l "
134134
"library.",
@@ -142,7 +142,7 @@ def build_isa_l():
142142
zip_safe=False,
143143
packages=find_packages('src'),
144144
package_dir={'': 'src'},
145-
package_data={'isal': ['*.pxd', '*.pyx',
145+
package_data={'isal': ['*.pxd', '*.pyx', '*.pyi', 'py.typed',
146146
# Include isa-l LICENSE and other relevant files
147147
# with the binary distribution.
148148
'isa-l/LICENSE', 'isa-l/README.md',

src/isal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
"__version__"
3030
]
3131

32-
__version__ = "0.4.0-dev"
32+
__version__ = "0.6.0-dev"

src/isal/_isal.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2020 Leiden University Medical Center
2+
#
3+
# Permission is hereby granted, free of charge, to any person obtaining a copy
4+
# of this software and associated documentation files (the "Software"), to deal
5+
# in the Software without restriction, including without limitation the rights
6+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
# copies of the Software, and to permit persons to whom the Software is
8+
# furnished to do so, subject to the following conditions:
9+
#
10+
# The above copyright notice and this permission notice shall be included in
11+
# all copies or substantial portions of the Software.
12+
#
13+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
# SOFTWARE.
20+
21+
ISAL_MAJOR_VERSION: int
22+
ISAL_MINOR_VERSION: int
23+
ISAL_PATCH_VERSION: int
24+
ISAL_VERSION: str

0 commit comments

Comments
 (0)