From b011809c59392f4998343862053a168100bfe033 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 11:09:03 +0000 Subject: [PATCH 1/7] apache-flink: add build-apache-flink.yml for riscv64 wheels flink-python's .pyx/.pxd files cimport compiled apache-beam internals (apache_beam.coders.coder_impl, .runners.worker.operations, .utils.windowed_value), size-checked Cython type imports that fail at wheel-import time, not build time, on an ABI mismatch. Blocked until a riscv64 apache-beam/pyarrow/grpcio/pemja land inside flink's declared windows (apache-beam>=2.54.0,<=2.61.0, pemja>=0.5.7,<0.5.8) - tracked separately. No native deps, no JVM at build time: apache-flink-libraries (the 329MB jar bundle) is a separate py2.py3-none-any wheel. Mirrors upstream's own build_python_wheels job (nightly.yml): plain cibuildwheel over the flink-python subdirectory of a full checkout, riscv64 substituted for its hardcoded x86_64 archs. The glibc_version_fix.h CFLAGS shim upstream adds for manylinux2014 x86_64 is dropped - the GLIBC_2.2.5 symbol version it force-links doesn't exist in riscv64's glibc symbol history. --- .github/workflows/build-apache-flink.yml | 113 +++++++++++++++++++++++ docs/packages/apache-flink.yaml | 5 + 2 files changed, 118 insertions(+) create mode 100644 .github/workflows/build-apache-flink.yml create mode 100644 docs/packages/apache-flink.yaml diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml new file mode 100644 index 000000000000..20be6fb9e27a --- /dev/null +++ b/.github/workflows/build-apache-flink.yml @@ -0,0 +1,113 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on upstream's own wheel build: +# https://github.com/apache/flink/blob/release-2.3.0/.github/workflows/nightly.yml +# (build_python_wheels job) +name: Build apache-flink wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/apache-flink.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-apache-flink.yml' + - 'docs/packages/apache-flink.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-apache-flink.yml' + - 'docs/packages/apache-flink.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: apache-flink + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build apache-flink ${{ matrix.version }} cp312-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + + env: + APACHE_FLINK_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout apache/flink release-${{ env.APACHE_FLINK_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: apache/flink + ref: release-${{ env.APACHE_FLINK_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + package-dir: flink-python + output-dir: wheelhouse/ + only: cp312-manylinux_riscv64 + env: + CIBW_ARCHS: riscv64 + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # apache-beam/pyarrow/grpcio/pemja, each pinned to the exact + # version inside flink's declared windows, are riscv64-only on our + # own registry. + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + # The cimport'd apache_beam.runners.worker.operations.Operation (and + # the other Beam cdef classes beam_operations_fast/beam_coder_impl_fast/ + # beam_stream_fast cimport) is a Cython size-checked type import: it + # fails at import time, not at build time, if the installed apache-beam + # wheel's ABI doesn't match what this wheel was compiled against. + CIBW_TEST_COMMAND: >- + python -c " + import pyflink; + from pyflink.fn_execution import coder_impl_fast, stream_fast; + from pyflink.fn_execution.beam import beam_coder_impl_fast, beam_operations_fast, beam_stream_fast; + from pyflink.table import aggregate_fast, window_aggregate_fast; + print('pyflink compiled extensions OK') + " + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: apache-flink-${{ env.APACHE_FLINK_VERSION }}-cp312-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish apache-flink ${{ 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: apache-flink-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/apache-flink.yaml b/docs/packages/apache-flink.yaml new file mode 100644 index 000000000000..91981c4297b7 --- /dev/null +++ b/docs/packages/apache-flink.yaml @@ -0,0 +1,5 @@ +package-name: apache-flink +source-code: https://github.com/apache/flink +license: Apache-2.0 +versions: +- version: 2.3.0 From 24ca2533ddfe14be7cf50cd17b2bae0ad3b07864 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 3 Nov 2026 11:11:23 +0000 Subject: [PATCH 2/7] build-apache-flink: fix leading-space IndentationError in CIBW_TEST_COMMAND gotcha 247: a folded >- scalar's `python -c "` on its own line puts a leading space before the first statement once YAML folds the newline into a space, so the -c string's first "line" begins with whitespace and Python raises IndentationError before any import runs ("python -c \" import pyflink; ..."). Keep the opening quote and the first statement on the same line. --- .github/workflows/build-apache-flink.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml index 20be6fb9e27a..837cb94708c6 100644 --- a/.github/workflows/build-apache-flink.yml +++ b/.github/workflows/build-apache-flink.yml @@ -80,9 +80,13 @@ jobs: # beam_stream_fast cimport) is a Cython size-checked type import: it # fails at import time, not at build time, if the installed apache-beam # wheel's ABI doesn't match what this wheel was compiled against. + # gotcha 247: a folded `>-` scalar's `python -c "` on its own line + # puts a leading space before the first statement once YAML folds the newline + # into a space, so the -c string's first "line" begins with whitespace and + # Python raises IndentationError before anything imports. Keep the opening + # quote and the first statement on the same line. CIBW_TEST_COMMAND: >- - python -c " - import pyflink; + python -c "import pyflink; from pyflink.fn_execution import coder_impl_fast, stream_fast; from pyflink.fn_execution.beam import beam_coder_impl_fast, beam_operations_fast, beam_stream_fast; from pyflink.table import aggregate_fast, window_aggregate_fast; From d11c47fe6c9335078cd5c809206f19737e94e9e9 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 5 Nov 2026 08:33:30 -0800 Subject: [PATCH 3/7] apache-flink: Use dynamic Python matrix --- .github/workflows/build-apache-flink.yml | 3 +-- docs/packages/apache-flink.yaml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml index 837cb94708c6..f4306793a657 100644 --- a/.github/workflows/build-apache-flink.yml +++ b/.github/workflows/build-apache-flink.yml @@ -49,8 +49,7 @@ jobs: strategy: fail-fast: false matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - + include: ${{ fromJSON(needs.setup.outputs.matrix) }} env: APACHE_FLINK_VERSION: ${{ matrix.version }} diff --git a/docs/packages/apache-flink.yaml b/docs/packages/apache-flink.yaml index 91981c4297b7..519396c77324 100644 --- a/docs/packages/apache-flink.yaml +++ b/docs/packages/apache-flink.yaml @@ -3,3 +3,4 @@ source-code: https://github.com/apache/flink license: Apache-2.0 versions: - version: 2.3.0 + python-versions: ['3.9', '3.10', '3.11', '3.12'] From f84be732cfe16cca4be75826142ac73c37a58b0f Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 6 Nov 2026 09:23:18 -0800 Subject: [PATCH 4/7] apache-flink: Use target file metadata --- docs/packages/apache-flink.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/packages/apache-flink.yaml b/docs/packages/apache-flink.yaml index 519396c77324..589324db1729 100644 --- a/docs/packages/apache-flink.yaml +++ b/docs/packages/apache-flink.yaml @@ -3,4 +3,8 @@ source-code: https://github.com/apache/flink license: Apache-2.0 versions: - version: 2.3.0 - python-versions: ['3.9', '3.10', '3.11', '3.12'] + files: + - python: 3.9:manylinux + - python: 3.10:manylinux + - python: 3.11:manylinux + - python: 3.12:manylinux From 9938222fbf12328f41e7bfe1feb2323fd4bb2512 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 6 Nov 2026 09:54:49 -0800 Subject: [PATCH 5/7] apache-flink: Avoid duplicate platform-independent builds --- .github/workflows/build-apache-flink.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml index f4306793a657..334dd38c31be 100644 --- a/.github/workflows/build-apache-flink.yml +++ b/.github/workflows/build-apache-flink.yml @@ -49,7 +49,7 @@ jobs: strategy: fail-fast: false matrix: - include: ${{ fromJSON(needs.setup.outputs.matrix) }} + version: ${{ fromJSON(needs.setup.outputs.versions) }} env: APACHE_FLINK_VERSION: ${{ matrix.version }} From 34f2650a4b0cd7b883f3d3cb3032800efdb967ab Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 8 Nov 2026 16:20:44 +0000 Subject: [PATCH 6/7] apache-flink: Fix smoke-test import path of table aggregate extensions aggregate_fast and window_aggregate_fast are built as pyflink.fn_execution.table.*, not pyflink.table.*. --- .github/workflows/build-apache-flink.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml index 334dd38c31be..c5ee59e71ba3 100644 --- a/.github/workflows/build-apache-flink.yml +++ b/.github/workflows/build-apache-flink.yml @@ -88,7 +88,7 @@ jobs: python -c "import pyflink; from pyflink.fn_execution import coder_impl_fast, stream_fast; from pyflink.fn_execution.beam import beam_coder_impl_fast, beam_operations_fast, beam_stream_fast; - from pyflink.table import aggregate_fast, window_aggregate_fast; + from pyflink.fn_execution.table import aggregate_fast, window_aggregate_fast; print('pyflink compiled extensions OK') " From 80bb3d05699362300bc0f92e891349a8e6c12de6 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 8 Nov 2026 17:47:23 +0000 Subject: [PATCH 7/7] apache-flink: Declare only the 3.12 target for 2.3.0 The build job only produces cp312-manylinux_riscv64, so the publish step rejected the release as incomplete for the declared 3.9, 3.10 and 3.11 targets. Those interpreters cannot be built: flink 2.3.0 pins apache-beam<=2.61.0, pyarrow<21.0.0 and pemja<0.5.8, and pypi.riseproject.dev only carries riscv64 wheels of apache-beam 2.61.0, pyarrow 16.1.0 and pemja 0.5.7 for cp312 (newer releases there start at cp312 as well). Declare only the 3.12 target until those exist. --- docs/packages/apache-flink.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/packages/apache-flink.yaml b/docs/packages/apache-flink.yaml index 589324db1729..a442c3643df1 100644 --- a/docs/packages/apache-flink.yaml +++ b/docs/packages/apache-flink.yaml @@ -4,7 +4,4 @@ license: Apache-2.0 versions: - version: 2.3.0 files: - - python: 3.9:manylinux - - python: 3.10:manylinux - - python: 3.11:manylinux - python: 3.12:manylinux