From 95e03f3b7d4fe9be08b2cb6f0354f5449ad312b8 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 3 Nov 2026 00:16:53 +0000 Subject: [PATCH 1/4] Add riscv64 build for docvortex docvortex is a pure pyo3/setuptools-rust abi3-py311 extension with no vendored binaries or GPU dependencies; all runtime/test deps already resolve riscv64 wheels on PyPI or pypi.riseproject.dev. Upstream ships no sdist and disables free-threaded builds itself, so this mirrors its own native-wheels.yml: one cp311-abi3 manylinux_riscv64 build, no musllinux, no cp*t job. --- .github/workflows/build-docvortex.yml | 151 ++++++++++++++++++++++++++ docs/packages/docvortex.yaml | 5 + 2 files changed, 156 insertions(+) create mode 100644 .github/workflows/build-docvortex.yml create mode 100644 docs/packages/docvortex.yaml diff --git a/.github/workflows/build-docvortex.yml b/.github/workflows/build-docvortex.yml new file mode 100644 index 000000000000..241544077b1c --- /dev/null +++ b/.github/workflows/build-docvortex.yml @@ -0,0 +1,151 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on upstream's wheel builder: +# https://github.com/myhloli/DocVortex/blob/v0.6.11/.github/workflows/native-wheels.yml +# docvortex is a PyO3/Rust extension built with setuptools-rust (not maturin): +# setup.py already sets py_limited_api itself, so no CIBW_CONFIG_SETTINGS is +# needed to get the abi3 wheel (contrast build-bcrypt.yml). Upstream refuses to +# build at all under free-threaded CPython (setup.py raises on +# Py_GIL_DISABLED), so there is no cp*t job here either. +name: Build docvortex wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/docvortex.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-docvortex.yml' + - 'docs/packages/docvortex.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-docvortex.yml' + - 'docs/packages/docvortex.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: docvortex + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build docvortex ${{ matrix.version }} cp311-abi3-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + env: + DOCVORTEX_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout docvortex ${{ env.DOCVORTEX_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: myhloli/DocVortex + ref: v${{ env.DOCVORTEX_VERSION }} + persist-credentials: false + + - name: Build and test wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + env: + CIBW_ARCHS: riscv64 + CIBW_BUILD: 'cp311-*' + CIBW_SKIP: '*-musllinux_*' + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_BEFORE_ALL_LINUX: >- + export CARGO_HOME=/opt/docvortex-cargo RUSTUP_HOME=/opt/docvortex-rustup; + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs + | sh -s -- -y --profile minimal --default-toolchain 1.98.1 + CIBW_ENVIRONMENT_LINUX: >- + PATH="/opt/docvortex-cargo/bin:$PATH" + CARGO_HOME=/opt/docvortex-cargo + RUSTUP_HOME=/opt/docvortex-rustup + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + CIBW_TEST_REQUIRES: pytest psutil pypdfium2==5.13.0 + CIBW_TEST_COMMAND: >- + python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo1.pdf && + python -m pytest + {project}/tests/test_native_parity.py + {project}/tests/test_rule_graphics_acceleration.py + {project}/tests/test_rule_text_acceleration.py + {project}/tests/test_rule_pixel_form_acceleration.py + {project}/tests/test_rule_layout_batch_acceleration.py + {project}/tests/test_rule_numeric_graphics_acceleration.py + {project}/tests/test_rule_fill_bands_acceleration.py + {project}/tests/test_native_statistics.py + {project}/tests/test_native_round3.py + {project}/tests/test_native_round4.py + {project}/tests/test_native_round5.py + {project}/tests/test_native_round6.py + {project}/tests/test_native_round7.py + {project}/tests/test_pdfium_bridge.py + {project}/tests/test_pdf_object_bridge.py + {project}/tests/test_pdf_classify_page_loading.py + {project}/tests/test_pdf_classify_resource_graph.py + {project}/tests/test_pdf_drawing_lines_extraction.py + {project}/tests/test_pdf_native_graphics_components.py + {project}/tests/unittest/test_flash_pdf_auxiliary_text.py + {project}/tests/test_pdf_snapshot.py + {project}/tests/test_native_inline_styles.py + {project}/tests/test_native_bitmap_crops.py + {project}/tests/test_pdf_render_session.py + {project}/tests/test_native_font_runtime.py + {project}/tests/test_native_text_pipeline.py + {project}/tests/test_native_text_snapshot.py + {project}/tests/test_native_classification.py + {project}/tests/test_native_image_text_classification.py + {project}/tests/unittest/test_pdf_classify_image_text.py + {project}/tests/unittest/test_flash_pdf_char_geometry.py + {project}/tests/test_native_table_candidates.py + {project}/tests/test_native_candidate_boundaries.py + {project}/tests/test_native_annotation_geometry.py + {project}/tests/unittest/test_native_pdf_table_demo_manifest.py + {project}/tests/test_pdf_analysis_api.py + {project}/tests/test_pdf_cpu_evidence.py + -q && + python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo2.pdf && + python {project}/tools/verify_nonpdf_wheel.py --output {project}/build/nonpdf-cp311 --run-tests + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: docvortex-${{ env.DOCVORTEX_VERSION }}-cp311-abi3-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish docvortex ${{ 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: docvortex-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/docvortex.yaml b/docs/packages/docvortex.yaml new file mode 100644 index 000000000000..838af25eecb7 --- /dev/null +++ b/docs/packages/docvortex.yaml @@ -0,0 +1,5 @@ +package-name: docvortex +source-code: https://github.com/myhloli/DocVortex +license: MIT AND Apache-2.0 AND BSD-3-Clause +versions: +- version: 0.6.11 From ae5dcebf8d4c036635b28f6798ad5789529b142f Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 3 Nov 2026 09:47:37 +0000 Subject: [PATCH 2/4] docvortex: test the cp311-abi3 wheel on cp312 The build succeeded but the pre-test install of the cp311-abi3 wheel failed under cp311: ERROR: No matching distribution found for onnxruntime<2,>=1.24.4 onnxruntime has no riscv64 wheel on PyPI, and pypi.riseproject.dev only carries cp312/cp313/cp314 builds. Keep cp311 as the build interpreter (gotcha 96), add cp312 so cibuildwheel reuses and tests the same abi3 wheel there, and skip only the cp311 test (gotcha 216). A dry-run resolve of the full dependency set for cp312 manylinux riscv64 finds binary wheels for everything (onnxruntime 1.31.0, numpy 2.4.3, pillow 12.3.0, pydantic_core, lxml, protobuf, rl_accel, ...). --- .github/workflows/build-docvortex.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docvortex.yml b/.github/workflows/build-docvortex.yml index 241544077b1c..00a80fcbbfec 100644 --- a/.github/workflows/build-docvortex.yml +++ b/.github/workflows/build-docvortex.yml @@ -70,8 +70,15 @@ jobs: uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 env: CIBW_ARCHS: riscv64 - CIBW_BUILD: 'cp311-*' + # The wheel is cp311-abi3, so it is compiled on cp311 (gotcha 96). + # Its runtime dependency onnxruntime has no cp311 riscv64 wheel on + # PyPI or pypi.riseproject.dev (cp312+ only), so the cp311 install + # before the tests cannot resolve. cibuildwheel reuses the same abi3 + # wheel for cp312 and tests it there; skip only the cp311 test + # (gotcha 216). + CIBW_BUILD: 'cp311-* cp312-*' CIBW_SKIP: '*-musllinux_*' + CIBW_TEST_SKIP: 'cp311-*' CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} CIBW_BEFORE_ALL_LINUX: >- export CARGO_HOME=/opt/docvortex-cargo RUSTUP_HOME=/opt/docvortex-rustup; From 4de1887bbfb5d26b4e59ed5ab7b9b65cbac1db80 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 3 Nov 2026 19:00:39 +0000 Subject: [PATCH 3/4] docvortex: prefer registry wheels over newer sdists in the test env The cp311-abi3 wheel built, but installing it on cp312 before the tests failed: pip picked pillow 13.0.0, which has no riscv64 wheel on PyPI, and its source build stopped on missing libjpeg headers. numpy went the same way (2.5.4 sdist built from source). pypi.riseproject.dev hosts cp312 riscv64 wheels for pillow 12.3.0 and numpy 2.4.3, both of which satisfy docvortex's requirements; PIP_PREFER_BINARY lets pip take them. --- .github/workflows/build-docvortex.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-docvortex.yml b/.github/workflows/build-docvortex.yml index 00a80fcbbfec..b1d3d2d7a766 100644 --- a/.github/workflows/build-docvortex.yml +++ b/.github/workflows/build-docvortex.yml @@ -89,6 +89,9 @@ jobs: CARGO_HOME=/opt/docvortex-cargo RUSTUP_HOME=/opt/docvortex-rustup PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + # PyPI's newest pillow/numpy can be sdist-only on riscv64 while our + # registry still hosts the previous release's wheel (gotcha 354). + CIBW_TEST_ENVIRONMENT: PIP_PREFER_BINARY=1 CIBW_TEST_REQUIRES: pytest psutil pypdfium2==5.13.0 CIBW_TEST_COMMAND: >- python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo1.pdf && From 69ecf39487d8490064b6322ae868cff4cc966ee8 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Wed, 4 Nov 2026 02:33:37 +0000 Subject: [PATCH 4/4] docvortex: test with pypdfium2 5.14.0 on riscv64 Upstream's golden fixtures were generated with pypdfium2 5.13.0, which bundles PDFium 153.0.7999 on every platform except riscv64, where the PyPI wheel is a source build of PDFium 151.0.7913. That older PDFium returns StemV-derived font weights (250/440 instead of 400), failing test_real_font_and_geometry_bridge_parity[caibao1] and [demo2]. pypdfium2 5.14.0's riscv64 wheel bundles PDFium 156.0.8076, which reproduces the golden font weights, and the full upstream test list passes with it on x86_64. --- .github/workflows/build-docvortex.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docvortex.yml b/.github/workflows/build-docvortex.yml index b1d3d2d7a766..863a4bc6a2ef 100644 --- a/.github/workflows/build-docvortex.yml +++ b/.github/workflows/build-docvortex.yml @@ -92,7 +92,17 @@ jobs: # PyPI's newest pillow/numpy can be sdist-only on riscv64 while our # registry still hosts the previous release's wheel (gotcha 354). CIBW_TEST_ENVIRONMENT: PIP_PREFER_BINARY=1 - CIBW_TEST_REQUIRES: pytest psutil pypdfium2==5.13.0 + # Upstream pins pypdfium2==5.13.0 because its golden fixtures + # (tests/fixtures/native_pdf_06_golden.json.gz) were generated with + # it, i.e. with PDFium 153.0.7999 from pdfium-binaries. The riscv64 + # 5.13.0 wheel on PyPI is instead a source build of the older PDFium + # 151.0.7913, whose FPDFText_GetFontWeight derives the weight from + # the font descriptor's StemV (250/440 instead of the golden's 400), + # failing test_real_font_and_geometry_bridge_parity[caibao1,demo2]. + # The riscv64 5.14.0 wheel bundles PDFium 156.0.8076, which matches + # the golden data (the whole suite also passes on x86_64 with + # 5.14.0), and is what `pypdfium2>=5.13.0,<6` resolves to anyway. + CIBW_TEST_REQUIRES: pytest psutil pypdfium2==5.14.0 CIBW_TEST_COMMAND: >- python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo1.pdf && python -m pytest