From 8fc01656947cd4bb21424a019b69bdb4587b5f79 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 14:23:26 +1100 Subject: [PATCH 1/7] Add support for Python 3.14 and use latest libjpeg release --- .github/workflows/pytest-builds.yml | 8 +-- .github/workflows/release-wheels.yml | 92 ++++++++++++++-------------- docs/changes/v2.4.0.rst | 7 +++ lib/libjpeg | 2 +- pyproject.toml | 8 +-- 5 files changed, 62 insertions(+), 55 deletions(-) create mode 100644 docs/changes/v2.4.0.rst diff --git a/.github/workflows/pytest-builds.yml b/.github/workflows/pytest-builds.yml index a36e55c..c2d8d06 100644 --- a/.github/workflows/pytest-builds.yml +++ b/.github/workflows/pytest-builds.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] arch: ['x64', 'x86'] steps: @@ -50,7 +50,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v6 @@ -86,7 +86,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v6 @@ -117,7 +117,7 @@ jobs: pytest --cov=libjpeg --cov-append libjpeg/tests - name: Switch to pydicom dev and rerun pytest - if: ${{ contains('3.10 3.11 3.12 3.13', matrix.python-version) }} + if: ${{ contains('3.10 3.11 3.12 3.13 3.14', matrix.python-version) }} run: | pip uninstall -y pydicom pip install git+https://github.com/pydicom/pydicom diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index d35852b..48418dc 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -3,9 +3,9 @@ name: release-deploy on: release: types: [ published ] - # push: - # branches: [ main ] - # pull_request: + push: + branches: [ main ] + pull_request: jobs: build-sdist: @@ -42,9 +42,6 @@ jobs: matrix: include: # Windows 32 bit - - os: windows-latest - python: 39 - platform_id: win32 - os: windows-latest python: 310 platform_id: win32 @@ -57,11 +54,11 @@ jobs: - os: windows-latest python: 313 platform_id: win32 + - os: windows-latest + python: 314 + platform_id: win32 # Windows 64 bit - - os: windows-latest - python: 39 - platform_id: win_amd64 - os: windows-latest python: 310 platform_id: win_amd64 @@ -74,12 +71,11 @@ jobs: - os: windows-latest python: 313 platform_id: win_amd64 + - os: windows-latest + python: 314 + platform_id: win_amd64 # Linux 64 bit manylinux2014 - - os: ubuntu-latest - python: 39 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - os: ubuntu-latest python: 310 platform_id: manylinux_x86_64 @@ -96,11 +92,12 @@ jobs: python: 313 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 314 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 # Linux aarch64 - - os: ubuntu-latest - python: 39 - platform_id: manylinux_aarch64 - os: ubuntu-latest python: 310 platform_id: manylinux_aarch64 @@ -113,11 +110,11 @@ jobs: - os: ubuntu-latest python: 313 platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 314 + platform_id: manylinux_aarch64 # MacOS x86_64 - - os: macos-12 - python: 39 - platform_id: macosx_x86_64 - os: macos-12 python: 310 platform_id: macosx_x86_64 @@ -130,6 +127,9 @@ jobs: - os: macos-12 python: 313 platform_id: macosx_x86_64 + - os: macos-12 + python: 314 + platform_id: macosx_x86_64 steps: - uses: actions/checkout@v6 @@ -145,12 +145,12 @@ jobs: - uses: actions/setup-python@v6 name: Install Python with: - python-version: '3.9' + python-version: '3.10' - name: Install cibuildwheel run: | python -m pip install -U pip - python -m pip install cibuildwheel>=2.21 + python -m pip install cibuildwheel>=3.4.0 - name: Build wheels env: @@ -178,9 +178,6 @@ jobs: matrix: include: # MacOS arm64 - - os: macos-14 - python: 39 - platform_id: macosx_arm64 - os: macos-14 python: 310 platform_id: macosx_arm64 @@ -193,6 +190,9 @@ jobs: - os: macos-14 python: 313 platform_id: macosx_arm64 + - os: macos-14 + python: 314 + platform_id: macosx_arm64 steps: - uses: actions/checkout@v6 @@ -202,10 +202,10 @@ jobs: - uses: actions/setup-python@v6 name: Install Python with: - python-version: '3.9' + python-version: '3.10' - name: Install cibuildwheel - run: python -m pip install cibuildwheel>=2.21 wheel>=0.42 + run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 - name: Build wheels env: @@ -274,23 +274,23 @@ jobs: # The pypi upload fails with non-linux containers, so grab the uploaded # artifacts and run using those # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 - deploy: - name: Upload wheels to PyPI - # needs: [ test-package ] - needs: [ build-wheels, build-sdist, build-wheels-macos-arm64 ] - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/project/pylibjpeg-libjpeg/ - permissions: - id-token: write - - steps: - - name: Download the wheels - uses: actions/download-artifact@v7 - with: - path: dist/ - merge-multiple: true - - - name: Publish package to PyPi - uses: pypa/gh-action-pypi-publish@release/v1 + # deploy: + # name: Upload wheels to PyPI + # # needs: [ test-package ] + # needs: [ build-wheels, build-sdist, build-wheels-macos-arm64 ] + # runs-on: ubuntu-latest + # environment: + # name: pypi + # url: https://pypi.org/project/pylibjpeg-libjpeg/ + # permissions: + # id-token: write + # + # steps: + # - name: Download the wheels + # uses: actions/download-artifact@v7 + # with: + # path: dist/ + # merge-multiple: true + # + # - name: Publish package to PyPi + # uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/docs/changes/v2.4.0.rst b/docs/changes/v2.4.0.rst new file mode 100644 index 0000000..ae97080 --- /dev/null +++ b/docs/changes/v2.4.0.rst @@ -0,0 +1,7 @@ +.. _v2.4.0: + +2.4.0 +===== + +* Added support for Python 3.14 and dropped 3.9 +* Updated to v1.71 of libjpeg diff --git a/lib/libjpeg b/lib/libjpeg index b911ba5..25f7128 160000 --- a/lib/libjpeg +++ b/lib/libjpeg @@ -1 +1 @@ -Subproject commit b911ba54feae159efd1adceda7b07e5a1db611da +Subproject commit 25f71280913fde7400801772bbf885bb3e873242 diff --git a/pyproject.toml b/pyproject.toml index 28d5088..4a12789 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,11 @@ classifiers=[ "Development Status :: 5 - Production/Stable", "Natural Language :: English", "Programming Language :: C++", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Operating System :: Microsoft :: Windows", @@ -56,10 +56,10 @@ packages = [ { include = "libjpeg" }, ] readme = "README.md" -version = "2.3.0" +version = "2.4.0" [tool.poetry.dependencies] -python = "^3.9" +python = "^3.10" numpy = "^2.0" [tool.poetry.plugins."pylibjpeg.jpeg_decoders"] @@ -86,7 +86,7 @@ omit = [ ] [tool.mypy] -python_version = "3.9" +python_version = "3.10" files = "libjpeg" exclude = ["libjpeg/tests"] show_error_codes = true From f8d15128dd267b5d6bf2b1a62d74074542e1d29d Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 14:42:49 +1100 Subject: [PATCH 2/7] Use Python 3.11 when building wheels --- .github/workflows/release-wheels.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index 48418dc..a9444a8 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-python@v6 name: Install Python with: - python-version: '3.10' + python-version: '3.11' - name: Build sdist run: | @@ -145,12 +145,12 @@ jobs: - uses: actions/setup-python@v6 name: Install Python with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: | python -m pip install -U pip - python -m pip install cibuildwheel>=3.4.0 + python -m pip install cibuildwheel>=3.4 - name: Build wheels env: @@ -202,7 +202,7 @@ jobs: - uses: actions/setup-python@v6 name: Install Python with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 From 7b699bc52c3485dbdb8def0ca5ab6633d721dbd4 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 14:44:48 +1100 Subject: [PATCH 3/7] Fix file naming clash --- build.py | 164 ------------------------------------------------- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 165 deletions(-) delete mode 100644 build.py diff --git a/build.py b/build.py deleted file mode 100644 index d1be493..0000000 --- a/build.py +++ /dev/null @@ -1,164 +0,0 @@ - -import os -from pathlib import Path -import platform -import shutil -from struct import unpack -import subprocess -import sys -from typing import Any, List, Dict - - -PACKAGE_DIR = Path(__file__).parent / "libjpeg" -LIB_DIR = Path(__file__).parent / "lib" -LIBJPEG_SRC = LIB_DIR / 'libjpeg' -INTERFACE_SRC = LIB_DIR / 'interface' - - -def build(setup_kwargs: Any) -> Any: - from setuptools import Extension - from setuptools.dist import Distribution - import Cython.Compiler.Options - from Cython.Build import build_ext, cythonize - import numpy - - # Compiler and linker arguments - extra_compile_args = [] - extra_link_args = [] - if platform.system() == 'Windows': - os.environ['LIB'] = os.path.abspath( - os.path.join(sys.executable, '../', 'libs') - ) - extra_compile_args = get_mscv_args() - elif platform.system() in ['Darwin', 'Linux']: - # Skip configuration if running with `sdist` - if 'sdist' not in sys.argv: - opts = get_gcc_args() - if sys.byteorder == "big": - if "-mfpmath=387" in opts["ADDOPTS"]: - opts["ADDOPTS"].remove("-mfpmath=387") - - extra_compile_args += opts['ADDOPTS'] - extra_link_args += opts['EXTRA_LIBS'] - - macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] - if unpack("h", b"\x00\x01")[0] == 1: - macros.append(("JPG_BIG_ENDIAN", "1")) - - ext = Extension( - '_libjpeg', - [os.fspath(p) for p in get_source_files()], - language='c++', - include_dirs=[ - os.fspath(LIBJPEG_SRC), - os.fspath(INTERFACE_SRC), - numpy.get_include(), - ], - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args, - define_macros=macros, - ) - - ext_modules = cythonize( - [ext], - include_path=ext.include_dirs, - language_level=3, - ) - - dist = Distribution({"ext_modules": ext_modules}) - cmd = build_ext(dist) - cmd.ensure_finalized() - cmd.run() - - for output in cmd.get_outputs(): - output = Path(output) - relative_ext = output.relative_to(cmd.build_lib) - shutil.copyfile(output, relative_ext) - - return setup_kwargs - - -def get_mscv_args() -> List[str]: - """Return a list of compiler args for MSVC++'s compiler.""" - flags = [ - '/GS', # Buffer security check - '/W3', # Warning level - '/Zc:wchar_t', # Use windows char type - '/Zc:inline', # Remove unreferenced function or data (...) - '/Zc:forScope', - '/Od', # Disable optimisation - '/Oy-', # (x86 only) don't omit frame pointer - '/openmp-', # Disable #pragma omp directive - '/FC', # Display full path of source code files - '/fp:precise', # Floating-point behaviour - '/Gd', # (x86 only) use __cdecl calling convention - '/GF-', # Disable string pooling - '/GR', # Enable run-time type info - '/RTC1', # Enable run-time error checking - '/MT', # Create multithreading executable - # /D defines constants and macros - '/D_UNICODE', - '/DUNICODE', - ] - - # Set the architecture based on system architecture and Python - is_x64 = platform.architecture()[0] == '64bit' - if is_x64 and sys.maxsize > 2**32: - flags.append('/DWIN64=1') - else: - # Architecture is 32-bit, or Python is 32-bit - flags.append('/DWIN32=1') - - return flags - - -def get_gcc_args() -> Dict[str, str]: - """Return a list of compiler and linker args for GCC/clang. - - The args are determined by running the src/libjpeg/configure script then - parsing src/libjpeg/automakefile for the relevant values. - - Returns - ------- - dict - A dict with keys COMPILER_CMD, CC_ONLY, SETTINGS, PREFIX, - PTHREADCFLAGS, PTHREADLDFLAGS, PTHREADLIBS, HWTYPE, HAVE_ADDONS, - BITSIZE, ADDOPTS, LIB_OPTS, EXTRA_LIBS, CPU, TUNE. - """ - # Run configure script once - # Using GCC or clang, run `configure` bash script once - if 'config.log' not in os.listdir(LIBJPEG_SRC): - # Needs to be determined before changing the working dir - fpath = os.path.abspath(LIBJPEG_SRC) - # Needs to be run from within the src/libjpeg directory - current_dir = os.getcwd() - os.chdir(LIBJPEG_SRC) - subprocess.call([os.path.join(fpath, 'configure')]) - os.chdir(current_dir) - - # Get compilation options - with open(os.path.join(LIBJPEG_SRC, 'automakefile')) as fp: - lines = fp.readlines() - - lines = [ll for ll in lines if not ll.startswith('#')] - opts = [ll.split('=', 1) for ll in lines] - opts = {vv[0].strip():list(vv[1].strip().split(' ')) for vv in opts} - - return opts - - -def get_source_files() -> List[Path]: - """Return a list of paths to the source files to be compiled.""" - source_files = [ - PACKAGE_DIR / '_libjpeg.pyx', - INTERFACE_SRC /'decode.cpp', - INTERFACE_SRC /'streamhook.cpp', - ] - for p in LIBJPEG_SRC.glob('*/*'): - if p.suffix == '.cpp': - source_files.append(p) - - # Source files must always be relative to the setup.py directory - source_files = [p.relative_to(PACKAGE_DIR.parent) for p in source_files] - - return source_files diff --git a/pyproject.toml b/pyproject.toml index 4a12789..e36ce12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ build-backend = "poetry.core.masonry.api" [tool.poetry.build] -script = "build.py" +script = "build_libjpeg.py" generate-setup-file = true From 5a602b6750843450ad186db89e55b8276f54f9cb Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 14:45:04 +1100 Subject: [PATCH 4/7] Really fix file naming clash --- build_libjpeg.py | 164 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 build_libjpeg.py diff --git a/build_libjpeg.py b/build_libjpeg.py new file mode 100644 index 0000000..d1be493 --- /dev/null +++ b/build_libjpeg.py @@ -0,0 +1,164 @@ + +import os +from pathlib import Path +import platform +import shutil +from struct import unpack +import subprocess +import sys +from typing import Any, List, Dict + + +PACKAGE_DIR = Path(__file__).parent / "libjpeg" +LIB_DIR = Path(__file__).parent / "lib" +LIBJPEG_SRC = LIB_DIR / 'libjpeg' +INTERFACE_SRC = LIB_DIR / 'interface' + + +def build(setup_kwargs: Any) -> Any: + from setuptools import Extension + from setuptools.dist import Distribution + import Cython.Compiler.Options + from Cython.Build import build_ext, cythonize + import numpy + + # Compiler and linker arguments + extra_compile_args = [] + extra_link_args = [] + if platform.system() == 'Windows': + os.environ['LIB'] = os.path.abspath( + os.path.join(sys.executable, '../', 'libs') + ) + extra_compile_args = get_mscv_args() + elif platform.system() in ['Darwin', 'Linux']: + # Skip configuration if running with `sdist` + if 'sdist' not in sys.argv: + opts = get_gcc_args() + if sys.byteorder == "big": + if "-mfpmath=387" in opts["ADDOPTS"]: + opts["ADDOPTS"].remove("-mfpmath=387") + + extra_compile_args += opts['ADDOPTS'] + extra_link_args += opts['EXTRA_LIBS'] + + macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] + if unpack("h", b"\x00\x01")[0] == 1: + macros.append(("JPG_BIG_ENDIAN", "1")) + + ext = Extension( + '_libjpeg', + [os.fspath(p) for p in get_source_files()], + language='c++', + include_dirs=[ + os.fspath(LIBJPEG_SRC), + os.fspath(INTERFACE_SRC), + numpy.get_include(), + ], + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + define_macros=macros, + ) + + ext_modules = cythonize( + [ext], + include_path=ext.include_dirs, + language_level=3, + ) + + dist = Distribution({"ext_modules": ext_modules}) + cmd = build_ext(dist) + cmd.ensure_finalized() + cmd.run() + + for output in cmd.get_outputs(): + output = Path(output) + relative_ext = output.relative_to(cmd.build_lib) + shutil.copyfile(output, relative_ext) + + return setup_kwargs + + +def get_mscv_args() -> List[str]: + """Return a list of compiler args for MSVC++'s compiler.""" + flags = [ + '/GS', # Buffer security check + '/W3', # Warning level + '/Zc:wchar_t', # Use windows char type + '/Zc:inline', # Remove unreferenced function or data (...) + '/Zc:forScope', + '/Od', # Disable optimisation + '/Oy-', # (x86 only) don't omit frame pointer + '/openmp-', # Disable #pragma omp directive + '/FC', # Display full path of source code files + '/fp:precise', # Floating-point behaviour + '/Gd', # (x86 only) use __cdecl calling convention + '/GF-', # Disable string pooling + '/GR', # Enable run-time type info + '/RTC1', # Enable run-time error checking + '/MT', # Create multithreading executable + # /D defines constants and macros + '/D_UNICODE', + '/DUNICODE', + ] + + # Set the architecture based on system architecture and Python + is_x64 = platform.architecture()[0] == '64bit' + if is_x64 and sys.maxsize > 2**32: + flags.append('/DWIN64=1') + else: + # Architecture is 32-bit, or Python is 32-bit + flags.append('/DWIN32=1') + + return flags + + +def get_gcc_args() -> Dict[str, str]: + """Return a list of compiler and linker args for GCC/clang. + + The args are determined by running the src/libjpeg/configure script then + parsing src/libjpeg/automakefile for the relevant values. + + Returns + ------- + dict + A dict with keys COMPILER_CMD, CC_ONLY, SETTINGS, PREFIX, + PTHREADCFLAGS, PTHREADLDFLAGS, PTHREADLIBS, HWTYPE, HAVE_ADDONS, + BITSIZE, ADDOPTS, LIB_OPTS, EXTRA_LIBS, CPU, TUNE. + """ + # Run configure script once + # Using GCC or clang, run `configure` bash script once + if 'config.log' not in os.listdir(LIBJPEG_SRC): + # Needs to be determined before changing the working dir + fpath = os.path.abspath(LIBJPEG_SRC) + # Needs to be run from within the src/libjpeg directory + current_dir = os.getcwd() + os.chdir(LIBJPEG_SRC) + subprocess.call([os.path.join(fpath, 'configure')]) + os.chdir(current_dir) + + # Get compilation options + with open(os.path.join(LIBJPEG_SRC, 'automakefile')) as fp: + lines = fp.readlines() + + lines = [ll for ll in lines if not ll.startswith('#')] + opts = [ll.split('=', 1) for ll in lines] + opts = {vv[0].strip():list(vv[1].strip().split(' ')) for vv in opts} + + return opts + + +def get_source_files() -> List[Path]: + """Return a list of paths to the source files to be compiled.""" + source_files = [ + PACKAGE_DIR / '_libjpeg.pyx', + INTERFACE_SRC /'decode.cpp', + INTERFACE_SRC /'streamhook.cpp', + ] + for p in LIBJPEG_SRC.glob('*/*'): + if p.suffix == '.cpp': + source_files.append(p) + + # Source files must always be relative to the setup.py directory + source_files = [p.relative_to(PACKAGE_DIR.parent) for p in source_files] + + return source_files From 12a12c2ce638cec22b57d329f7f73297eba2ce70 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 15:10:12 +1100 Subject: [PATCH 5/7] Use newer macos runner for x86 --- .github/workflows/release-wheels.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index a9444a8..d817355 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -29,7 +29,7 @@ jobs: poetry build -f sdist - name: Store artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: sdist path: ./dist @@ -115,19 +115,19 @@ jobs: platform_id: manylinux_aarch64 # MacOS x86_64 - - os: macos-12 + - os: macos-14-large python: 310 platform_id: macosx_x86_64 - - os: macos-12 + - os: macos-14-large python: 311 platform_id: macosx_x86_64 - - os: macos-12 + - os: macos-14-large python: 312 platform_id: macosx_x86_64 - - os: macos-12 + - os: macos-14-large python: 313 platform_id: macosx_x86_64 - - os: macos-12 + - os: macos-14-large python: 314 platform_id: macosx_x86_64 @@ -165,7 +165,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: Store artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist @@ -216,7 +216,7 @@ jobs: python -m cibuildwheel --output-dir dist - name: Store artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist/*.whl @@ -239,7 +239,7 @@ jobs: # python-version: ${{ matrix.python-version }} # # - name: Download the wheels - # uses: actions/download-artifact@v7 + # uses: actions/download-artifact@v8 # with: # path: dist/ # merge-multiple: true @@ -287,7 +287,7 @@ jobs: # # steps: # - name: Download the wheels - # uses: actions/download-artifact@v7 + # uses: actions/download-artifact@v8 # with: # path: dist/ # merge-multiple: true From 7da93495cff669d1e341cb51da6fa27143b30001 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 15:12:56 +1100 Subject: [PATCH 6/7] Use even newer macos runner for x86 --- .github/workflows/release-wheels.yml | 240 +++++++++++++-------------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index d817355..671a8d2 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -42,92 +42,92 @@ jobs: matrix: include: # Windows 32 bit - - os: windows-latest - python: 310 - platform_id: win32 - - os: windows-latest - python: 311 - platform_id: win32 - - os: windows-latest - python: 312 - platform_id: win32 - - os: windows-latest - python: 313 - platform_id: win32 - - os: windows-latest - python: 314 - platform_id: win32 + # - os: windows-latest + # python: 310 + # platform_id: win32 + # - os: windows-latest + # python: 311 + # platform_id: win32 + # - os: windows-latest + # python: 312 + # platform_id: win32 + # - os: windows-latest + # python: 313 + # platform_id: win32 + # - os: windows-latest + # python: 314 + # platform_id: win32 # Windows 64 bit - - os: windows-latest - python: 310 - platform_id: win_amd64 - - os: windows-latest - python: 311 - platform_id: win_amd64 - - os: windows-latest - python: 312 - platform_id: win_amd64 - - os: windows-latest - python: 313 - platform_id: win_amd64 - - os: windows-latest - python: 314 - platform_id: win_amd64 + # - os: windows-latest + # python: 310 + # platform_id: win_amd64 + # - os: windows-latest + # python: 311 + # platform_id: win_amd64 + # - os: windows-latest + # python: 312 + # platform_id: win_amd64 + # - os: windows-latest + # python: 313 + # platform_id: win_amd64 + # - os: windows-latest + # python: 314 + # platform_id: win_amd64 # Linux 64 bit manylinux2014 - - os: ubuntu-latest - python: 310 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 311 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 312 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 313 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - - os: ubuntu-latest - python: 314 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 + # - os: ubuntu-latest + # python: 310 + # platform_id: manylinux_x86_64 + # manylinux_image: manylinux2014 + # - os: ubuntu-latest + # python: 311 + # platform_id: manylinux_x86_64 + # manylinux_image: manylinux2014 + # - os: ubuntu-latest + # python: 312 + # platform_id: manylinux_x86_64 + # manylinux_image: manylinux2014 + # - os: ubuntu-latest + # python: 313 + # platform_id: manylinux_x86_64 + # manylinux_image: manylinux2014 + # - os: ubuntu-latest + # python: 314 + # platform_id: manylinux_x86_64 + # manylinux_image: manylinux2014 # Linux aarch64 - - os: ubuntu-latest - python: 310 - platform_id: manylinux_aarch64 - - os: ubuntu-latest - python: 311 - platform_id: manylinux_aarch64 - - os: ubuntu-latest - python: 312 - platform_id: manylinux_aarch64 - - os: ubuntu-latest - python: 313 - platform_id: manylinux_aarch64 - - os: ubuntu-latest - python: 314 - platform_id: manylinux_aarch64 + # - os: ubuntu-latest + # python: 310 + # platform_id: manylinux_aarch64 + # - os: ubuntu-latest + # python: 311 + # platform_id: manylinux_aarch64 + # - os: ubuntu-latest + # python: 312 + # platform_id: manylinux_aarch64 + # - os: ubuntu-latest + # python: 313 + # platform_id: manylinux_aarch64 + # - os: ubuntu-latest + # python: 314 + # platform_id: manylinux_aarch64 # MacOS x86_64 - - os: macos-14-large + - os: macos-26-intel python: 310 platform_id: macosx_x86_64 - - os: macos-14-large + - os: macos-26-intel python: 311 platform_id: macosx_x86_64 - - os: macos-14-large + - os: macos-26-intel python: 312 platform_id: macosx_x86_64 - - os: macos-14-large + - os: macos-26-intel python: 313 platform_id: macosx_x86_64 - - os: macos-14-large + - os: macos-26-intel python: 314 platform_id: macosx_x86_64 @@ -170,56 +170,56 @@ jobs: name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist - build-wheels-macos-arm64: - name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - # MacOS arm64 - - os: macos-14 - python: 310 - platform_id: macosx_arm64 - - os: macos-14 - python: 311 - platform_id: macosx_arm64 - - os: macos-14 - python: 312 - platform_id: macosx_arm64 - - os: macos-14 - python: 313 - platform_id: macosx_arm64 - - os: macos-14 - python: 314 - platform_id: macosx_arm64 - - steps: - - uses: actions/checkout@v6 - with: - submodules: true - - - uses: actions/setup-python@v6 - name: Install Python - with: - python-version: '3.11' - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 - - - name: Build wheels - env: - CIBW_BUILD: cp${{ matrix.python }}-* - CIBW_ARCHS_MACOS: arm64 - CIBW_BUILD_VERBOSITY: 1 - run: | - python -m cibuildwheel --output-dir dist - - - name: Store artifacts - uses: actions/upload-artifact@v7 - with: - name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} - path: ./dist/*.whl + # build-wheels-macos-arm64: + # name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} + # runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: false + # matrix: + # include: + # # MacOS arm64 + # - os: macos-14 + # python: 310 + # platform_id: macosx_arm64 + # - os: macos-14 + # python: 311 + # platform_id: macosx_arm64 + # - os: macos-14 + # python: 312 + # platform_id: macosx_arm64 + # - os: macos-14 + # python: 313 + # platform_id: macosx_arm64 + # - os: macos-14 + # python: 314 + # platform_id: macosx_arm64 + # + # steps: + # - uses: actions/checkout@v6 + # with: + # submodules: true + # + # - uses: actions/setup-python@v6 + # name: Install Python + # with: + # python-version: '3.11' + # + # - name: Install cibuildwheel + # run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 + # + # - name: Build wheels + # env: + # CIBW_BUILD: cp${{ matrix.python }}-* + # CIBW_ARCHS_MACOS: arm64 + # CIBW_BUILD_VERBOSITY: 1 + # run: | + # python -m cibuildwheel --output-dir dist + # + # - name: Store artifacts + # uses: actions/upload-artifact@v7 + # with: + # name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} + # path: ./dist/*.whl # test-package: From 0b38fb59d65f6e894ccf82e089ca126eb4d016b5 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 7 Mar 2026 15:20:04 +1100 Subject: [PATCH 7/7] Finalise --- .github/workflows/release-wheels.yml | 276 +++++++++++++-------------- 1 file changed, 138 insertions(+), 138 deletions(-) diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index 671a8d2..a41698d 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -3,9 +3,9 @@ name: release-deploy on: release: types: [ published ] - push: - branches: [ main ] - pull_request: + # push: + # branches: [ main ] + # pull_request: jobs: build-sdist: @@ -42,77 +42,77 @@ jobs: matrix: include: # Windows 32 bit - # - os: windows-latest - # python: 310 - # platform_id: win32 - # - os: windows-latest - # python: 311 - # platform_id: win32 - # - os: windows-latest - # python: 312 - # platform_id: win32 - # - os: windows-latest - # python: 313 - # platform_id: win32 - # - os: windows-latest - # python: 314 - # platform_id: win32 + - os: windows-latest + python: 310 + platform_id: win32 + - os: windows-latest + python: 311 + platform_id: win32 + - os: windows-latest + python: 312 + platform_id: win32 + - os: windows-latest + python: 313 + platform_id: win32 + - os: windows-latest + python: 314 + platform_id: win32 # Windows 64 bit - # - os: windows-latest - # python: 310 - # platform_id: win_amd64 - # - os: windows-latest - # python: 311 - # platform_id: win_amd64 - # - os: windows-latest - # python: 312 - # platform_id: win_amd64 - # - os: windows-latest - # python: 313 - # platform_id: win_amd64 - # - os: windows-latest - # python: 314 - # platform_id: win_amd64 + - os: windows-latest + python: 310 + platform_id: win_amd64 + - os: windows-latest + python: 311 + platform_id: win_amd64 + - os: windows-latest + python: 312 + platform_id: win_amd64 + - os: windows-latest + python: 313 + platform_id: win_amd64 + - os: windows-latest + python: 314 + platform_id: win_amd64 # Linux 64 bit manylinux2014 - # - os: ubuntu-latest - # python: 310 - # platform_id: manylinux_x86_64 - # manylinux_image: manylinux2014 - # - os: ubuntu-latest - # python: 311 - # platform_id: manylinux_x86_64 - # manylinux_image: manylinux2014 - # - os: ubuntu-latest - # python: 312 - # platform_id: manylinux_x86_64 - # manylinux_image: manylinux2014 - # - os: ubuntu-latest - # python: 313 - # platform_id: manylinux_x86_64 - # manylinux_image: manylinux2014 - # - os: ubuntu-latest - # python: 314 - # platform_id: manylinux_x86_64 - # manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 310 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 311 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 312 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 313 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 314 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 # Linux aarch64 - # - os: ubuntu-latest - # python: 310 - # platform_id: manylinux_aarch64 - # - os: ubuntu-latest - # python: 311 - # platform_id: manylinux_aarch64 - # - os: ubuntu-latest - # python: 312 - # platform_id: manylinux_aarch64 - # - os: ubuntu-latest - # python: 313 - # platform_id: manylinux_aarch64 - # - os: ubuntu-latest - # python: 314 - # platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 310 + platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 311 + platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 312 + platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 313 + platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 314 + platform_id: manylinux_aarch64 # MacOS x86_64 - os: macos-26-intel @@ -170,56 +170,56 @@ jobs: name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist - # build-wheels-macos-arm64: - # name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} - # runs-on: ${{ matrix.os }} - # strategy: - # fail-fast: false - # matrix: - # include: - # # MacOS arm64 - # - os: macos-14 - # python: 310 - # platform_id: macosx_arm64 - # - os: macos-14 - # python: 311 - # platform_id: macosx_arm64 - # - os: macos-14 - # python: 312 - # platform_id: macosx_arm64 - # - os: macos-14 - # python: 313 - # platform_id: macosx_arm64 - # - os: macos-14 - # python: 314 - # platform_id: macosx_arm64 - # - # steps: - # - uses: actions/checkout@v6 - # with: - # submodules: true - # - # - uses: actions/setup-python@v6 - # name: Install Python - # with: - # python-version: '3.11' - # - # - name: Install cibuildwheel - # run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 - # - # - name: Build wheels - # env: - # CIBW_BUILD: cp${{ matrix.python }}-* - # CIBW_ARCHS_MACOS: arm64 - # CIBW_BUILD_VERBOSITY: 1 - # run: | - # python -m cibuildwheel --output-dir dist - # - # - name: Store artifacts - # uses: actions/upload-artifact@v7 - # with: - # name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} - # path: ./dist/*.whl + build-wheels-macos-arm64: + name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + # MacOS arm64 + - os: macos-14 + python: 310 + platform_id: macosx_arm64 + - os: macos-14 + python: 311 + platform_id: macosx_arm64 + - os: macos-14 + python: 312 + platform_id: macosx_arm64 + - os: macos-14 + python: 313 + platform_id: macosx_arm64 + - os: macos-14 + python: 314 + platform_id: macosx_arm64 + + steps: + - uses: actions/checkout@v6 + with: + submodules: true + + - uses: actions/setup-python@v6 + name: Install Python + with: + python-version: '3.11' + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel>=3.4 wheel>=0.42 + + - name: Build wheels + env: + CIBW_BUILD: cp${{ matrix.python }}-* + CIBW_ARCHS_MACOS: arm64 + CIBW_BUILD_VERBOSITY: 1 + run: | + python -m cibuildwheel --output-dir dist + + - name: Store artifacts + uses: actions/upload-artifact@v7 + with: + name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} + path: ./dist/*.whl # test-package: @@ -274,23 +274,23 @@ jobs: # The pypi upload fails with non-linux containers, so grab the uploaded # artifacts and run using those # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 - # deploy: - # name: Upload wheels to PyPI - # # needs: [ test-package ] - # needs: [ build-wheels, build-sdist, build-wheels-macos-arm64 ] - # runs-on: ubuntu-latest - # environment: - # name: pypi - # url: https://pypi.org/project/pylibjpeg-libjpeg/ - # permissions: - # id-token: write - # - # steps: - # - name: Download the wheels - # uses: actions/download-artifact@v8 - # with: - # path: dist/ - # merge-multiple: true - # - # - name: Publish package to PyPi - # uses: pypa/gh-action-pypi-publish@release/v1 + deploy: + name: Upload wheels to PyPI + # needs: [ test-package ] + needs: [ build-wheels, build-sdist, build-wheels-macos-arm64 ] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/pylibjpeg-libjpeg/ + permissions: + id-token: write + + steps: + - name: Download the wheels + uses: actions/download-artifact@v8 + with: + path: dist/ + merge-multiple: true + + - name: Publish package to PyPi + uses: pypa/gh-action-pypi-publish@release/v1