Skip to content

Commit 8c99519

Browse files
authored
Merge pull request #37 from pycompression/release_0.4.0
Release 0.4.0
2 parents 05c1bfa + 9ee5deb commit 8c99519

File tree

6 files changed

+136
-78
lines changed

6 files changed

+136
-78
lines changed

.github/workflows/ci.yml

Lines changed: 113 additions & 18 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,19 +44,78 @@ jobs:
4244
run: tox -e docs
4345
env:
4446
PYTHON_ISAL_LINK_DYNAMIC: True
45-
test:
46-
runs-on: ubuntu-20.04
47+
twine_check:
48+
needs: lint
49+
runs-on: ${{ matrix.os }}
50+
strategy:
51+
matrix:
52+
python-version:
53+
- 3.6
54+
os: ["ubuntu-latest" ]
55+
steps:
56+
- uses: actions/[email protected]
57+
with:
58+
submodules: recursive
59+
- name: Set up Python ${{ matrix.python-version }}
60+
uses: actions/[email protected]
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
64+
run: sudo apt install yasm
65+
if: runner.os == 'Linux'
66+
- name: Install build dependencies (Macos)
67+
run: brew install yasm automake autoconf
68+
if: runner.os == 'macOS'
69+
- name: Install twine, cython wheel and upgrade setuptools
70+
run: pip install --upgrade twine cython wheel setuptools
71+
- name: create dists
72+
run: python setup.py sdist bdist_wheel
73+
- name: check dists
74+
run: twine check dist/*
75+
76+
test-static:
77+
needs: lint
78+
runs-on: ${{ matrix.os }}
4779
strategy:
4880
matrix:
4981
python-version:
5082
- 3.6
5183
- 3.7
5284
- 3.8
5385
- 3.9
54-
linking_method:
55-
- static
56-
- dynamic
86+
os: ["ubuntu-latest"]
87+
include:
88+
- os: "macos-latest"
89+
python-version: 3.8
90+
steps:
91+
- uses: actions/[email protected]
92+
with:
93+
submodules: recursive
94+
- name: Set up Python ${{ matrix.python-version }}
95+
uses: actions/[email protected]
96+
with:
97+
python-version: ${{ matrix.python-version }}
98+
- name: Install tox and upgrade setuptools
99+
run: pip install --upgrade tox setuptools
100+
- name: Install build dependencies (Linux) # Yasm in pypa/manylinux images.
101+
run: sudo apt install yasm
102+
if: runner.os == 'Linux'
103+
- name: Install build dependencies (Macos)
104+
run: brew install yasm automake autoconf
105+
if: runner.os == 'macOS'
106+
- name: Run tests
107+
run: tox -e py3
108+
- name: Upload coverage report
109+
uses: codecov/codecov-action@v1
110+
111+
test-dynamic:
112+
runs-on: ${{ matrix.os }}
57113
needs: lint
114+
strategy:
115+
matrix:
116+
python-version:
117+
- 3.6
118+
os: ["ubuntu-20.04"]
58119
steps:
59120
- uses: actions/[email protected]
60121
with:
@@ -63,22 +124,56 @@ jobs:
63124
uses: actions/[email protected]
64125
with:
65126
python-version: ${{ matrix.python-version }}
66-
- name: Install tox and upgrade setuptools and pip
67-
run: pip install --upgrade tox setuptools pip
68127
- name: Install isal
69-
if: ${{ matrix.linking_method == 'dynamic' }}
70128
run: sudo apt-get install libisal-dev
71-
- name: Install yasm # Yasm in pypa/manylinux images.
72-
run: sudo apt install yasm
73-
if: ${{ matrix.linking_method == 'static' }}
129+
- name: Install tox and upgrade setuptools and pip
130+
run: pip install --upgrade tox setuptools pip
74131
- name: Run tests (dynamic link)
75132
run: tox -e py3
76133
env:
77134
PYTHON_ISAL_LINK_DYNAMIC: True
78-
if: ${{ matrix.linking_method == 'dynamic' }}
79-
- name: Run tests (dynamic link)
80-
run: tox -e py3
81-
if: ${{ matrix.linking_method == 'static' }}
82-
- name: Upload coverage report
83-
if: ${{ matrix.python-version == 3.6 && matrix.linking_method == 'static'}} # Only upload coverage once
84-
uses: codecov/codecov-action@v1
135+
136+
deploy:
137+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
138+
runs-on: ${{ matrix.os }}
139+
needs: [lint, docs, test-static, test-dynamic, twine_check]
140+
strategy:
141+
matrix:
142+
os: [ "macos-latest", "ubuntu-latest" ]
143+
steps:
144+
- uses: actions/[email protected]
145+
with:
146+
submodules: recursive
147+
- uses: actions/setup-python@v2
148+
name: Install Python
149+
- name: Install cibuildwheel twine
150+
run: python -m pip install cibuildwheel twine
151+
- name: Install build dependencies (Macos)
152+
run: brew install yasm automake autoconf
153+
if: runner.os == 'macOS'
154+
- name: Build wheels
155+
run: cibuildwheel --output-dir dist
156+
env:
157+
CIBW_BUILD: "cp3{6,7,8,9}-*"
158+
CIBW_SKIP: "*-win32 *-manylinux_i686" # Skip 32 bit.
159+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
160+
# Below command fails when data is not correctly statically linked
161+
# Full tests not needed: these are done prior to building.
162+
CIBW_TEST_COMMAND: "python -c 'from isal import isal_zlib, igzip; isal_zlib.adler32(b\"bla\")'"
163+
- name: Build sdist
164+
if: "runner.os == 'Linux'"
165+
run: python setup.py sdist
166+
- name: Publish package to TestPyPI
167+
# pypa/gh-action-pypi-publish@master does not work on OSX
168+
# Alpha, Beta and dev releases contain a - in the tag.
169+
if: contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')
170+
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
171+
env:
172+
TWINE_USERNAME: __token__
173+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
174+
- name: Publish package to PyPI
175+
if: "!contains(github.ref, '-') && startsWith(github.ref, 'refs/tags')"
176+
run: twine upload dist/*
177+
env:
178+
TWINE_USERNAME: __token__
179+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ 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.4.0
11+
-----------------
12+
+ Move wheel building to cibuildwheel on github actions CI. Wheels are now
13+
provided for Mac OS as well.
14+
+ Make a tiny change in setup.py so python-isal can be build on Mac OS X.
15+
1016
version 0.3.0
1117
-----------------
1218
+ Set included ISA-L library at version 2.30.0.

README.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,21 @@ Installation
4747
------------
4848
Installation with pip
4949
.....................
50-
Python-isal can be installed with::
5150

52-
pip install isal
51+
+ Linux and MacOS: ``pip install isal``. Wheels are provided, so installation should
52+
be almost instantaneous.
53+
+ Windows: Installation is not supported yet.
5354

54-
This will include a staticallly linked version of isa-l. On Linux, wheels
55-
are provided. If a wheel is not provided for your system the installation will
56-
build ISA-L first in a temporary directory. Please check the `ISA-L homepage
57-
<https://github.com/intel/isa-l>`_ for the build requirements.
55+
The installation will include a staticallly linked version of isa-l. On Linux
56+
and MacOS, wheels are provided. If a wheel is not provided for your system the
57+
installation will build ISA-L first in a temporary directory. Please check the
58+
`ISA-L homepage <https://github.com/intel/isa-l>`_ for the build requirements.
5859

5960
The latest development version of python-isal can be installed with::
6061

6162
pip install git+https://github.com/rhpvorderman/python-isal.git
6263

64+
This requires having the build requirements installed.
6365
If you wish to link
6466
dynamically against a version of libisal installed on your system use::
6567

buildwheels.sh

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

setup.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,15 @@ def build_isa_l():
9797
build_env = os.environ.copy()
9898
# Add -fPIC flag to allow static compilation
9999
build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC"
100-
100+
if hasattr(os, "sched_getaffinity"):
101+
cpu_count = len(os.sched_getaffinity(0))
102+
else: # sched_getaffinity not available on all platforms
103+
cpu_count = os.cpu_count() or 1 # os.cpu_count() can return None
101104
run_args = dict(cwd=build_dir, env=build_env)
102105
subprocess.run(os.path.join(build_dir, "autogen.sh"), **run_args)
103106
subprocess.run([os.path.join(build_dir, "configure"),
104107
"--prefix", temp_prefix], **run_args)
105-
subprocess.run(["make", "-j", str(len(os.sched_getaffinity(0)))],
108+
subprocess.run(["make", "-j", str(cpu_count)],
106109
**run_args)
107110
subprocess.run(["make", "install"], **run_args)
108111
shutil.rmtree(build_dir)
@@ -111,7 +114,7 @@ def build_isa_l():
111114

112115
setup(
113116
name="isal",
114-
version="0.3.0",
117+
version="0.4.0",
115118
description="Faster zlib and gzip compatible compression and "
116119
"decompression by providing python bindings for the isa-l "
117120
"library.",
@@ -142,6 +145,8 @@ def build_isa_l():
142145
"Development Status :: 3 - Alpha",
143146
"Topic :: System :: Archiving :: Compression",
144147
"License :: OSI Approved :: MIT License",
148+
"Operating System :: POSIX :: Linux",
149+
"Operating System :: MacOS"
145150
],
146151
python_requires=">=3.6",
147152
ext_modules=[

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.3.0"
32+
__version__ = "0.4.0"

0 commit comments

Comments
 (0)