Skip to content

Commit 990cb29

Browse files
authored
Add wheel build for 3.10, fix build_tools issue (#48)
* Includes `build_tools` in source distribution * Adds wheels for Python 3.10 * Reduces the amount of packaged openjpeg source code * Tests both wheels and sdist before uploading to PyPI * Adds `pyproject.toml` for better build process
1 parent 9a6e2f3 commit 990cb29

File tree

8 files changed

+238
-68
lines changed

8 files changed

+238
-68
lines changed

.github/workflows/pytest-builds.yml

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

33
on:
44
push:
@@ -8,11 +8,11 @@ on:
88
jobs:
99
windows:
1010
runs-on: windows-latest
11-
timeout-minutes: 10
11+
timeout-minutes: 30
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: [3.6, 3.7, 3.8, 3.9]
15+
python-version: ['3.7', '3.8', '3.9', '3.10']
1616
arch: ['x64', 'x86']
1717

1818
steps:
@@ -29,9 +29,9 @@ jobs:
2929
- name: Install package and dependencies
3030
run: |
3131
python -m pip install -U pip
32-
python -m pip install pytest coverage pytest-cov cython numpy wheel
33-
python -m pip install .
32+
python -m pip install -U pytest coverage pytest-cov
3433
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
34+
python -m pip install .
3535
3636
- name: Run pytest
3737
run: |
@@ -44,11 +44,11 @@ jobs:
4444
4545
osx:
4646
runs-on: macos-latest
47-
timeout-minutes: 10
47+
timeout-minutes: 30
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
python-version: [3.7, 3.8, 3.9]
51+
python-version: ['3.7', '3.8', '3.9', '3.10']
5252

5353
steps:
5454
- uses: actions/checkout@v2
@@ -63,10 +63,9 @@ jobs:
6363
- name: Install package and dependencies
6464
run: |
6565
python -m pip install -U pip
66-
python -m pip install wheel
67-
python -m pip install .
6866
python -m pip install pytest coverage pytest-cov
6967
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
68+
python -m pip install .
7069
7170
- name: Run pytest
7271
run: |
@@ -79,11 +78,11 @@ jobs:
7978
8079
ubuntu:
8180
runs-on: ubuntu-latest
82-
timeout-minutes: 10
81+
timeout-minutes: 30
8382
strategy:
8483
fail-fast: false
8584
matrix:
86-
python-version: [3.7, 3.8, 3.9]
85+
python-version: ['3.7', '3.8', '3.9', '3.10']
8786

8887
steps:
8988
- uses: actions/checkout@v2
@@ -98,10 +97,9 @@ jobs:
9897
- name: Install package and dependencies
9998
run: |
10099
python -m pip install -U pip
101-
python -m pip install wheel
102-
python -m pip install .
103100
python -m pip install pytest coverage pytest-cov
104101
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
102+
python -m pip install .
105103
106104
- name: Run pytest
107105
run: |
@@ -119,9 +117,5 @@ jobs:
119117
pytest --cov openjpeg --ignore=openjpeg/src/openjpeg
120118
121119
- name: Send coverage results
122-
if: ${{ success() }}
123-
run: |
124-
bash <(curl --connect-timeout 10 --retry 10 --retry-max-time \
125-
0 https://codecov.io/bash) || (sleep 30 && bash <(curl \
126-
--connect-timeout 10 --retry 10 --retry-max-time \
127-
0 https://codecov.io/bash))
120+
if: ${{ success() && matrix.coverage == 'coverage' }}
121+
uses: codecov/codecov-action@v1

.github/workflows/release-wheels.yml

Lines changed: 178 additions & 17 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,34 +130,89 @@ 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
30136
run: |
31-
python -m pip install cibuildwheel==1.10.0
32-
33-
- name: Build sdist
34-
run: |
35-
python setup.py sdist
137+
python -m pip install -U pip
138+
python -m pip install cibuildwheel==2.3.1
36139
37140
- 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
38147
run: |
39148
python --version
40149
python -m cibuildwheel --output-dir dist
41150
42-
- uses: actions/upload-artifact@v2
151+
- name: Store artifacts
152+
uses: actions/upload-artifact@v2
43153
with:
44154
name: wheels
45155
path: ./dist
46156

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-openjpeg
190+
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
191+
python -m pip install -U --find-links dist/ pylibjpeg-openjpeg
192+
python -c "import pytest; pytest.main(['--pyargs', 'openjpeg.tests'])"
193+
deactivate
194+
195+
- name: Install from package tarball and test
196+
run: |
197+
python -m venv env/testsrc
198+
source env/testsrc/bin/activate
199+
python -m pip install -U pip
200+
python -m pip install pytest pydicom pylibjpeg
201+
python -m pip uninstall -y pylibjpeg-openjpeg
202+
python -m pip install git+https://github.com/pydicom/pylibjpeg-data
203+
python -m pip install -U dist/pylibjpeg-openjpeg-*.tar.gz
204+
python -c "import pytest; pytest.main(['--pyargs', 'openjpeg.tests'])"
205+
deactivate
206+
207+
47208
# The pypi upload fails with non-linux containers, so grab the uploaded
48209
# artifacts and run using those
49210
# See: https://github.com/pypa/gh-action-pypi-publish/discussions/15
50211
deploy:
51212
name: Upload wheels to PyPI
52-
needs:
53-
- build_wheels
213+
needs: [ test-package ]
54214
runs-on: ubuntu-latest
215+
timeout-minutes: 10
55216

56217
steps:
57218
- name: Download the wheels

MANIFEST.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
recursive-include openjpeg/src *
1+
recursive-include openjpeg/src/interface *
2+
3+
# openjpeg source file includes
4+
recursive-include openjpeg/src/openjpeg/src/lib/openjp2 *
5+
include openjpeg/src/openjpeg/src/lib/CMakeLists.txt
6+
include openjpeg/src/openjpeg/src/CMakeLists.txt
7+
recursive-include openjpeg/src/openjpeg/cmake *
8+
include openjpeg/src/openjpeg/*.md
9+
include openjpeg/src/openjpeg/LICENSE
10+
11+
recursive-include build_tools *

openjpeg/_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.1.1'
6+
__version__ = '1.2.0'
77

88

99
VERSION_PATTERN = r"""

0 commit comments

Comments
 (0)