From 727e56d868ec8ff453ca98ab08eef51bac0b19ff Mon Sep 17 00:00:00 2001 From: scaramallion Date: Thu, 18 Jan 2024 22:13:56 +1100 Subject: [PATCH] Add wheels for Python 3.12 (#12) --- .github/workflows/release-wheels.yml | 100 ++++++++++++++++++++------- MANIFEST.in | 7 ++ jpeg_ls/__init__.py | 2 +- jpeg_ls/tests/__init__.py | 0 pyproject.toml | 9 +-- 5 files changed, 87 insertions(+), 31 deletions(-) create mode 100644 MANIFEST.in create mode 100644 jpeg_ls/tests/__init__.py diff --git a/.github/workflows/release-wheels.yml b/.github/workflows/release-wheels.yml index cd26e5a..aca5337 100644 --- a/.github/workflows/release-wheels.yml +++ b/.github/workflows/release-wheels.yml @@ -3,6 +3,9 @@ name: release-deploy on: release: types: [ published ] + # push: + # branches: [ main ] + # pull_request: jobs: build-sdist: @@ -10,11 +13,11 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.10' @@ -22,13 +25,13 @@ jobs: - name: Build sdist run: | python -m pip install -U pip - python -m pip install numpy cython - python setup.py sdist + python -m pip install build + python -m build --sdist - name: Store artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: sdist path: ./dist build-wheels: @@ -39,9 +42,6 @@ jobs: matrix: include: # Windows 64 bit - - os: windows-latest - python: 37 - platform_id: win_amd64 - os: windows-latest python: 38 platform_id: win_amd64 @@ -54,12 +54,11 @@ jobs: - os: windows-latest python: 311 platform_id: win_amd64 + - os: windows-latest + python: 312 + platform_id: win_amd64 # Linux 64 bit manylinux2014 - - os: ubuntu-latest - python: 37 - platform_id: manylinux_x86_64 - manylinux_image: manylinux2014 - os: ubuntu-latest python: 38 platform_id: manylinux_x86_64 @@ -76,11 +75,12 @@ jobs: python: 311 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 + - os: ubuntu-latest + python: 312 + platform_id: manylinux_x86_64 + manylinux_image: manylinux2014 # Linux aarch64 - - os: ubuntu-latest - python: 37 - platform_id: manylinux_aarch64 - os: ubuntu-latest python: 38 platform_id: manylinux_aarch64 @@ -93,11 +93,11 @@ jobs: - os: ubuntu-latest python: 311 platform_id: manylinux_aarch64 + - os: ubuntu-latest + python: 312 + platform_id: manylinux_aarch64 # MacOS x86_64 - - os: macos-latest - python: 37 - platform_id: macosx_x86_64 - os: macos-latest python: 38 platform_id: macosx_x86_64 @@ -110,6 +110,9 @@ jobs: - os: macos-latest python: 311 platform_id: macosx_x86_64 + - os: macos-latest + python: 312 + platform_id: macosx_x86_64 # MacOS arm64 - os: macos-latest @@ -124,9 +127,14 @@ jobs: - os: macos-latest python: 311 platform_id: macosx_arm64 + - os: macos-latest + python: 312 + platform_id: macosx_arm64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + submodules: true - name: Set up QEMU if: ${{ matrix.platform_id == 'manylinux_aarch64' }} @@ -142,7 +150,7 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - python -m pip install cibuildwheel==2.12.0 + python -m pip install cibuildwheel>=2.16 - name: Build wheels env: @@ -157,12 +165,52 @@ jobs: python -m cibuildwheel --output-dir dist - name: Store artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: wheels + name: wheel-${{ matrix.python }}-${{ matrix.platform_id }} path: ./dist - # Todo: download and test the packages after we have working tests + test-package: + name: Test built package + needs: [ build-wheels, build-sdist ] + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Download the wheels + uses: actions/download-artifact@v4 + with: + path: dist/ + merge-multiple: true + + - name: Install from package wheels and test + run: | + python -m venv testwhl + source testwhl/bin/activate + python -m pip install -U pip + python -m pip install pytest numpy + python -m pip install -U --pre --find-links dist/ pyjpegls + python -m pytest --pyargs jpeg_ls.tests + deactivate + + - name: Install from package tarball and test + run: | + python -m venv testsrc + source testsrc/bin/activate + python -m pip install -U pip + python -m pip install pytest numpy + python -m pip install -U dist/pyjpegls*.tar.gz + python -m pytest --pyargs jpeg_ls.tests + deactivate # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 deploy: @@ -178,10 +226,10 @@ jobs: steps: - name: Download the wheels - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: wheels path: dist/ + merge-multiple: true - name: Publish package to PyPi uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..6dfa8a8 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include lib/charls/src/* +include lib/charls/include/charls/* +include lib/charls/README.md +include jpeg_ls/tests/jlsimV100/* +include jpeg_ls/*.cpp +include jpeg_ls/*.h +include jpeg_ls/*.pyx diff --git a/jpeg_ls/__init__.py b/jpeg_ls/__init__.py index 305322d..4e1ed0d 100644 --- a/jpeg_ls/__init__.py +++ b/jpeg_ls/__init__.py @@ -4,7 +4,7 @@ from _CharLS import encode_to_buffer, decode_from_buffer # noqa: F401 -__version__ = "1.1.0.dev0" +__version__ = "1.1.0" # Setup default logging diff --git a/jpeg_ls/tests/__init__.py b/jpeg_ls/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index d3173d7..5651712 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,8 @@ authors = [ classifiers = [ "License :: OSI Approved :: MIT License", - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", + "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", @@ -32,7 +33,7 @@ license = {text = "MIT"} name = "pyjpegls" readme = "readme.md" requires-python = ">=3.8" -version = "1.1.0.dev0" +version = "1.1.0" [project.urls] documentation = "https://pydicom.github.io/pydicom" @@ -40,5 +41,5 @@ download = "https://github.com/pydicom/pyjpegls/archive/master.zip" homepage = "https://github.com/pydicom/pyjpegls" repository = "https://github.com/pydicom/pyjpegls" -[tool.setuptools.packages] -find = {} +[tool.setuptools.packages.find] +include = ["jpeg_ls*"]