Repository navigation
pymupdf: update packages #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 The RISE Project | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # This workflow is based on upstream's own wheel build driver: | |
| # https://github.com/pymupdf/PyMuPDF/blob/1.28.2/scripts/gh_release.py | |
| name: Build pymupdf wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/pymupdf.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-pymupdf.yml' | |
| - 'docs/packages/pymupdf.yaml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-pymupdf.yml' | |
| - 'docs/packages/pymupdf.yaml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: pymupdf | |
| version: ${{ inputs.version }} | |
| build_wheels: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build pymupdf ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| # setup.py downloads and builds the whole of MuPDF (incl. tesseract/leptonica), | |
| # generates its C++ bindings with libclang and wraps them with SWIG. | |
| timeout-minutes: 1440 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| include: | |
| # Upstream publishes cp310-abi3 + cp314t, i.e. two builds (gotcha 11). | |
| # cp312 is our floor, so the abi3 wheel is built there. | |
| - python: cp312 | |
| py_limited_api: '1' | |
| test_extras: '' | |
| # pipcl asserts Py_LIMITED_API and Py_GIL_DISABLED are mutually | |
| # exclusive, so the free-threaded build must opt out of the stable ABI. | |
| - python: cp314t | |
| py_limited_api: '0' | |
| # conftest.py pip-installs opencv-python (+ llama_index, rapidocr) for the | |
| # pymupdf_layout/pymupdf4llm tests; opencv has no free-threaded riscv64 | |
| # wheel and its sdist doesn't build, so test the lite (core) package only. | |
| test_extras: '0' | |
| env: | |
| PYMUPDF_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout pymupdf ${{ env.PYMUPDF_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: pymupdf/PyMuPDF | |
| ref: ${{ env.PYMUPDF_VERSION }} | |
| persist-credentials: false | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| output-dir: wheelhouse/ | |
| only: ${{ matrix.python }}-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # mupdf's C++ bindings are generated by parsing its headers with | |
| # libclang; the `libclang` PyPI wheel setup.py asks for by default has | |
| # no riscv64 build, so use the image's own libclang.so instead (dnf | |
| # `clang-devel` supplies the unversioned symlink clang.cindex dlopens). | |
| CIBW_BEFORE_ALL_LINUX: dnf install -y clang-devel | |
| CIBW_ENVIRONMENT: >- | |
| PYMUPDF_SETUP_PY_LIMITED_API=${{ matrix.py_limited_api }} | |
| PYMUPDF_SETUP_LIBCLANG=clang | |
| PYMUPDF_SETUP_SWIG=swig | |
| XCFLAGS=-D__LITTLE_ENDIAN__ | |
| XCXXFLAGS=-D__LITTLE_ENDIAN__ | |
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| # Installing the test dependencies must not compile pillow/psutil: their newest | |
| # PyPI releases have no riscv64 wheel, only our registry does, and only-binary | |
| # keeps pip on those wheels (pillow's sdist fails without the jpeg headers). | |
| CIBW_TEST_ENVIRONMENT: >- | |
| PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| PIP_ONLY_BINARY=pillow,psutil | |
| PYMUPDF_TEST_USE_LAYOUT=${{ matrix.test_extras }} | |
| PYMUPDF_TEST_USE_4LLM=${{ matrix.test_extras }} | |
| # Upstream's test deps (scripts/gh_release.py:test_packages), minus the | |
| # linters - see the ignores below. | |
| CIBW_TEST_REQUIRES: pytest fontTools pymupdf-fonts pillow psutil | |
| # Upstream harness, restricted to `-i r` (the default implementation): | |
| # `rR` reruns the whole suite a second time with PYMUPDF_USE_EXTRA=0, | |
| # which doubles an already long run on this runner. | |
| # test_flake8/test_pylint/test_codespell lint the source tree rather | |
| # than exercise the wheel, and track whatever linter version pip | |
| # resolves today, so they are arch-independent noise here. | |
| CIBW_TEST_COMMAND: >- | |
| python {package}/tests/run_compound.py -i r | |
| pytest {package}/tests | |
| --ignore {package}/tests/test_flake8.py | |
| --ignore {package}/tests/test_pylint.py | |
| --ignore {package}/tests/test_codespell.py | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pymupdf-${{ env.PYMUPDF_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish pymupdf ${{ matrix.version }} | |
| needs: [setup, build_wheels] | |
| if: needs.setup.outputs.versions != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| secrets: | |
| app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} | |
| with: | |
| artifact-pattern: pymupdf-${{ matrix.version }}-*-manylinux_riscv64 |