Skip to content

Commit ad836c6

Browse files
authored
Add wheels for Python 3.10 (#30)
* Add wheels for Python 3.10 * Test wheels and sdist before uploading to PyPI * Add `pyproject.toml` for better build process
1 parent 462b99e commit ad836c6

File tree

8 files changed

+247
-96
lines changed

8 files changed

+247
-96
lines changed

.github/workflows/pytest-builds.yml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
name: build
1+
name: unit-tests
22

33
on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
branches: [ master ]
87

98
jobs:
109
windows:
1110
runs-on: windows-latest
12-
timeout-minutes: 10
11+
timeout-minutes: 30
1312
strategy:
1413
fail-fast: false
1514
matrix:
16-
python-version: [3.6, 3.7, 3.8, 3.9]
15+
python-version: ['3.7', '3.8', '3.9', '3.10']
1716
arch: ['x64', 'x86']
1817

1918
steps:
@@ -31,27 +30,27 @@ jobs:
3130
run: |
3231
python --version
3332
python -m pip install -U pip
34-
python -m pip install pytest cython numpy
35-
python -m pip install . -v
33+
python -m pip install -U pytest
3634
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
35+
python -m pip install .
3736
3837
- name: Run pytest
3938
run: |
40-
pytest
39+
pytest --ignore=libjpeg/src/libjpeg
4140
4241
- name: Install pydicom release and rerun pytest
4342
run: |
4443
pip install pydicom pylibjpeg
4544
pip uninstall -y pylibjpeg-openjpeg
46-
pytest
45+
pytest --ignore=libjpeg/src/libjpeg
4746
4847
osx:
4948
runs-on: macos-latest
50-
timeout-minutes: 10
49+
timeout-minutes: 30
5150
strategy:
5251
fail-fast: false
5352
matrix:
54-
python-version: [3.6, 3.7, 3.8, 3.9]
53+
python-version: ['3.7', '3.8', '3.9', '3.10']
5554

5655
steps:
5756
- uses: actions/checkout@v2
@@ -67,28 +66,27 @@ jobs:
6766
run: |
6867
python --version
6968
python -m pip install -U pip
70-
python -m pip install cython numpy
71-
python -m pip install . -v
72-
python -m pip install pytest
69+
python -m pip install -U pytest
7370
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
71+
python -m pip install .
7472
7573
- name: Run pytest
7674
run: |
77-
pytest
75+
pytest --ignore=libjpeg/src/libjpeg
7876
7977
- name: Install pydicom release and rerun pytest
8078
run: |
8179
pip install pydicom pylibjpeg
8280
pip uninstall -y pylibjpeg-openjpeg
83-
pytest
81+
pytest --ignore=libjpeg/src/libjpeg
8482
8583
ubuntu:
8684
runs-on: ubuntu-latest
87-
timeout-minutes: 10
85+
timeout-minutes: 30
8886
strategy:
8987
fail-fast: false
9088
matrix:
91-
python-version: [3.6, 3.7, 3.8, 3.9]
89+
python-version: ['3.7', '3.8', '3.9', '3.10']
9290

9391
steps:
9492
- uses: actions/checkout@v2
@@ -104,10 +102,9 @@ jobs:
104102
run: |
105103
python --version
106104
python -m pip install -U pip
107-
python -m pip install cython numpy
108-
python -m pip install .
109-
python -m pip install pytest coverage pytest-cov
105+
python -m pip install -U pytest coverage pytest-cov
110106
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
107+
python -m pip install .
111108
112109
- name: Run pytest
113110
run: |
@@ -126,9 +123,5 @@ jobs:
126123
pytest --cov=libjpeg --cov-append libjpeg/tests
127124
128125
- name: Send coverage results
129-
if: ${{ success() }}
130-
run: |
131-
bash <(curl --connect-timeout 10 --retry 10 --retry-max-time \
132-
0 https://codecov.io/bash) || (sleep 30 && bash <(curl \
133-
--connect-timeout 10 --retry 10 --retry-max-time \
134-
0 https://codecov.io/bash))
126+
if: ${{ success() && matrix.coverage == 'coverage' }}
127+
uses: codecov/codecov-action@v1

.github/workflows/release-wheels.yml

Lines changed: 179 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,126 @@
1-
name: Build wheels and deploy to PyPI
1+
name: release-deploy
22

33
on:
44
release:
55
types: [ published ]
66

77
jobs:
8-
build_wheels:
9-
name: Build wheels for ${{ matrix.os }}
8+
build-sdist:
9+
name: Build source distribution
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 10
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
17+
- uses: actions/setup-python@v2
18+
name: Install Python
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Build sdist
23+
run: |
24+
python -m pip install .
25+
python setup.py sdist
26+
27+
- name: Store artifacts
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: wheels
31+
path: ./dist
32+
33+
build-wheels:
34+
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
1035
runs-on: ${{ matrix.os }}
11-
env:
12-
CIBW_BUILD: "cp3*-*"
13-
CIBW_SKIP: "cp35-*"
1436
strategy:
37+
fail-fast: false
1538
matrix:
16-
os: [ubuntu-latest, windows-latest, macos-latest]
17-
python-version: [3.9]
39+
include:
40+
# Windows 32 bit
41+
- os: windows-latest
42+
python: 37
43+
platform_id: win32
44+
- os: windows-latest
45+
python: 38
46+
platform_id: win32
47+
- os: windows-latest
48+
python: 39
49+
platform_id: win32
50+
- os: windows-latest
51+
python: 310
52+
platform_id: win32
53+
54+
# Windows 64 bit
55+
- os: windows-latest
56+
python: 37
57+
platform_id: win_amd64
58+
- os: windows-latest
59+
python: 38
60+
platform_id: win_amd64
61+
- os: windows-latest
62+
python: 39
63+
platform_id: win_amd64
64+
- os: windows-latest
65+
python: 310
66+
platform_id: win_amd64
67+
68+
# Linux 64 bit manylinux2010
69+
- os: ubuntu-latest
70+
python: 37
71+
platform_id: manylinux_x86_64
72+
manylinux_image: manylinux2010
73+
- os: ubuntu-latest
74+
python: 38
75+
platform_id: manylinux_x86_64
76+
manylinux_image: manylinux2010
77+
- os: ubuntu-latest
78+
python: 39
79+
platform_id: manylinux_x86_64
80+
manylinux_image: manylinux2010
81+
82+
# Linux 64 bit manylinux2014
83+
- os: ubuntu-latest
84+
python: 37
85+
platform_id: manylinux_x86_64
86+
manylinux_image: manylinux2014
87+
- os: ubuntu-latest
88+
python: 38
89+
platform_id: manylinux_x86_64
90+
manylinux_image: manylinux2014
91+
- os: ubuntu-latest
92+
python: 39
93+
platform_id: manylinux_x86_64
94+
manylinux_image: manylinux2014
95+
- os: ubuntu-latest
96+
python: 310
97+
platform_id: manylinux_x86_64
98+
manylinux_image: manylinux2014
99+
100+
# MacOS x86_64
101+
- os: macos-latest
102+
python: 37
103+
platform_id: macosx_x86_64
104+
- os: macos-latest
105+
python: 38
106+
platform_id: macosx_x86_64
107+
- os: macos-latest
108+
python: 39
109+
platform_id: macosx_x86_64
110+
- os: macos-latest
111+
python: 310
112+
platform_id: macosx_x86_64
113+
114+
# MacOS arm64
115+
- os: macos-latest
116+
python: 38
117+
platform_id: macosx_arm64
118+
- os: macos-latest
119+
python: 39
120+
platform_id: macosx_arm64
121+
- os: macos-latest
122+
python: 310
123+
platform_id: macosx_arm64
18124

19125
steps:
20126
- uses: actions/checkout@v2
@@ -24,35 +130,90 @@ jobs:
24130
- uses: actions/setup-python@v2
25131
name: Install Python
26132
with:
27-
python-version: ${{ matrix.python-version }}
133+
python-version: '3.9'
28134

29135
- name: Install cibuildwheel
30-
31136
run: |
32-
python -m pip install cibuildwheel==1.10.0
33-
34-
- name: Build sdist
35-
run: |
36-
python setup.py sdist
137+
python -m pip install -U pip
138+
python -m pip install cibuildwheel==2.3.1
37139
38140
- name: Build wheels
141+
env:
142+
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
143+
CIBW_ARCHS: all
144+
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
145+
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
146+
CIBW_BUILD_VERBOSITY: 1
39147
run: |
40148
python --version
41149
python -m cibuildwheel --output-dir dist
42150
43-
- uses: actions/upload-artifact@v2
151+
- name: Store artifacts
152+
uses: actions/upload-artifact@v2
44153
with:
45154
name: wheels
46155
path: ./dist
47156

157+
test-package:
158+
name: Test built package
159+
needs: [ build-wheels, build-sdist ]
160+
runs-on: ubuntu-latest
161+
timeout-minutes: 30
162+
strategy:
163+
fail-fast: false
164+
matrix:
165+
python-version: ['3.7', '3.8', '3.9', '3.10']
166+
167+
steps:
168+
- uses: actions/checkout@v2
169+
with:
170+
submodules: true
171+
172+
- name: Set up Python ${{ matrix.python-version }}
173+
uses: actions/setup-python@v2
174+
with:
175+
python-version: ${{ matrix.python-version }}
176+
177+
- name: Download the wheels
178+
uses: actions/download-artifact@v2
179+
with:
180+
name: wheels
181+
path: dist/
182+
183+
- name: Install from package wheels and test
184+
run: |
185+
python -m venv env/test
186+
source env/test/bin/activate
187+
python -m pip install -U pip
188+
python -m pip install pytest pydicom pylibjpeg
189+
python -m pip uninstall -y pylibjpeg-libjpeg
190+
python -m pip uninstall -y pylibjpeg-openjpeg
191+
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
192+
python -m pip install -U --find-links dist/ pylibjpeg-libjpeg
193+
python -c "import pytest; pytest.main(['--pyargs', 'libjpeg.tests'])"
194+
deactivate
195+
196+
- name: Install from package tarball and test
197+
run: |
198+
python -m venv env/testsrc
199+
source env/testsrc/bin/activate
200+
python -m pip install -U pip
201+
python -m pip install pytest pydicom pylibjpeg
202+
python -m pip uninstall -y pylibjpeg-libjpeg
203+
python -m pip uninstall -y pylibjpeg-openjpeg
204+
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
205+
python -m pip install -U dist/pylibjpeg-libjpeg-*.tar.gz
206+
python -c "import pytest; pytest.main(['--pyargs', 'libjpeg.tests'])"
207+
deactivate
208+
48209
# The pypi upload fails with non-linux containers, so grab the uploaded
49210
# artifacts and run using those
50211
# See: https://github.com/pypa/gh-action-pypi-publish/discussions/15
51212
deploy:
52213
name: Upload wheels to PyPI
53-
needs:
54-
- build_wheels
214+
needs: [ test-package ]
55215
runs-on: ubuntu-latest
216+
timeout-minutes: 10
56217

57218
steps:
58219
- name: Download the wheels

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
[![Build Status](https://github.com/pydicom/pylibjpeg-libjpeg/workflows/unit-tests/badge.svg)](https://github.com/pydicom/pylibjpeg-libjpeg/actions?query=workflow%3Aunit-tests)
12
[![codecov](https://codecov.io/gh/pydicom/pylibjpeg-libjpeg/branch/master/graph/badge.svg)](https://codecov.io/gh/pydicom/pylibjpeg-libjpeg)
2-
[![Build Status](https://github.com/pydicom/pylibjpeg-libjpeg/workflows/build/badge.svg)](https://github.com/pydicom/pylibjpeg-libjpeg/actions?query=workflow%3Abuild)
33
[![PyPI version](https://badge.fury.io/py/pylibjpeg-libjpeg.svg)](https://badge.fury.io/py/pylibjpeg-libjpeg)
44
[![Python versions](https://img.shields.io/pypi/pyversions/pylibjpeg-libjpeg.svg)](https://img.shields.io/pypi/pyversions/pylibjpeg-libjpeg.svg)
55

66
## pylibjpeg-libjpeg
77

8-
A Python 3.6+ wrapper for Thomas Richter's
8+
A Python 3.7+ wrapper for Thomas Richter's
99
[libjpeg](https://github.com/thorfdbg/libjpeg), with a focus on use as a
1010
plugin for [pylibjpeg](http://github.com/pydicom/pylibjpeg).
1111

12-
Linux, OSX and Windows are all supported.
12+
Linux, MacOS and Windows are all supported.
1313

1414
### Installation
1515
#### Dependencies

docs/changes/v1.3.0.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _v1.3.0:
2+
3+
1.3.0
4+
=====
5+
6+
Changes
7+
.......
8+
9+
* Added support for Python 3.10

libjpeg/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44

55

6-
__version__ = '1.2.0'
6+
__version__ = '1.3.0'
77

88

99
VERSION_PATTERN = r"""

0 commit comments

Comments
 (0)