Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/build-datasketches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Mirrors the Linux core of upstream's .github/workflows/build_wheels.yml.
name: Build datasketches wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'datasketches version to build (git tag, e.g. 5.2.0)'
required: true
default: '5.2.0'
pull_request:
paths:
- '.github/workflows/build-datasketches.yml'
- 'patches/datasketches/**'

concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '5.2.0' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
DATASKETCHES_VERSION: ${{ inputs.version || '5.2.0' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64

jobs:
setup:
uses: $/.github/workflows/_setup.yml

build_wheels:
needs: [setup]
name: Build datasketches ${{ inputs.version || '5.2.0' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
python: ["cp312", "cp313", "cp314", "cp314t"]
libc: [manylinux, musllinux]

steps:
- name: Checkout apache/datasketches-python ${{ env.DATASKETCHES_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: apache/datasketches-python
ref: ${{ env.DATASKETCHES_VERSION }}
persist-credentials: false

- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false

# vector_of_kll_sketches's own operator= assigns to its const k_/d_ members,
# which GCC 13 rejects when instantiating the nanobind bindings (not riscv64-specific,
# reproduces on any manylinux arch; gotcha 23 shape).
- name: Patch datasketches source
run: git apply python-wheels/patches/datasketches/${{ env.DATASKETCHES_VERSION }}/00*.patch

- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
env:
CIBW_ARCHS: riscv64
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.libc }}_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }}
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
CIBW_TEST_REQUIRES: pytest
# tests/ has __init__.py, and the checkout root's own datasketches/ package
# (source, no compiled _datasketches) would shadow the installed wheel if
# pytest ran from the checkout (gotcha 25); stage only tests/ into an empty cwd.
CIBW_TEST_SOURCES: tests
CIBW_TEST_COMMAND: python -m pytest tests

- name: Check wheel contents
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
path = sys.argv[1]
names = zipfile.ZipFile(path).namelist()
exts = [n for n in names if n.endswith(".so")]
assert exts and all("_datasketches" in n for n in exts), exts
licences = {n.split(".dist-info/licenses/", 1)[1] for n in names
if ".dist-info/licenses/" in n and not n.endswith("/")}
assert "LICENSE" in licences, licences
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: datasketches-${{ env.DATASKETCHES_VERSION }}-${{ matrix.python }}-${{ matrix.libc }}_riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish datasketches ${{ inputs.version || '5.2.0' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: datasketches-${{ inputs.version || '5.2.0' }}-*riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 3a3ab48c3cae8ccb6c07db0a728cec4060821f7c Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Tue, 8 Sep 2026 18:46:43 +0200
Subject: [PATCH] Drop const from vector_of_kll_sketches k_/d_ so assignment
operators compile

vector_of_kll_sketches declares k_ and d_ const, but its own out-of-line
operator= (copy) and operator= (move) both assign to them
(k_ = copy.k_; d_ = copy.d_;), which is ill-formed - assigning to a
const member outside of initialization. GCC 13 (the manylinux_riscv64
image's compiler) instantiates and rejects both operators while
building the vector_of_kll_ints_sketches/vector_of_kll_floats_sketches
nanobind bindings:

src/vector_of_kll.cpp:146:6: error: assignment of read-only member
'datasketches::vector_of_kll_sketches<T, C>::k_'

Reproduces identically with the same compiler on manylinux_2_39_aarch64
(no riscv64 involvement) and is unrelated to nanobind's version: this
tag's CMakeLists.txt pins no nanobind ceiling, main is unchanged since
this file was last touched, and it is not riscv64-specific.

Upstream-Status: To upstream [python-wheels only files issues/PRs against riseproject-dev/python-wheels; not yet reported to apache/datasketches-python]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
src/vector_of_kll.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vector_of_kll.cpp b/src/vector_of_kll.cpp
index 3bbe17b..7013915 100644
--- a/src/vector_of_kll.cpp
+++ b/src/vector_of_kll.cpp
@@ -104,8 +104,8 @@ class vector_of_kll_sketches {
template<typename TT>
Array2D<TT> make_ndarray(size_t rows, size_t cols) const;

- const uint32_t k_; // kll sketch k parameter
- const uint32_t d_; // number of dimensions (here: sketches) to hold
+ uint32_t k_; // kll sketch k parameter
+ uint32_t d_; // number of dimensions (here: sketches) to hold
std::vector<kll_sketch<T, C>> sketches_;
};

--
2.50.1 (Apple Git-155)

Loading