From 38be6cca955a6f556b0743063020e7d3c86d7761 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 13 Oct 2026 20:39:03 +0000 Subject: [PATCH 1/3] tenseal: Add version 0.3.18 --- .github/workflows/build-tenseal.yml | 124 ++++++ docs/packages/tenseal.yaml | 6 + ...of-the-FetchContent-d-C-dependencies.patch | 375 ++++++++++++++++++ 3 files changed, 505 insertions(+) create mode 100644 .github/workflows/build-tenseal.yml create mode 100644 docs/packages/tenseal.yaml create mode 100644 patches/tenseal/0.3.18/0001-ship-the-licences-of-the-FetchContent-d-C-dependencies.patch diff --git a/.github/workflows/build-tenseal.yml b/.github/workflows/build-tenseal.yml new file mode 100644 index 000000000000..d086058cf595 --- /dev/null +++ b/.github/workflows/build-tenseal.yml @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on the `build_wheels` job of +# https://github.com/OpenMined/TenSEAL/blob/v0.3.18/.github/workflows/publish_wheels.yml +# and the `Build` job of +# https://github.com/OpenMined/TenSEAL/blob/v0.3.18/.github/workflows/tests.yml +name: Build tenseal wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/tenseal.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-tenseal.yml' + - 'docs/packages/tenseal.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-tenseal.yml' + - 'docs/packages/tenseal.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: tenseal + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build tenseal ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # pybind11 2.12 has no free-threaded support; upstream builds no cp3XXt either. + python: ["cp312", "cp313", "cp314"] + env: + TENSEAL_VERSION: ${{ matrix.version }} + CPP_TESTS: >- + && sh -c "cd {project} && CMAKE_POLICY_VERSION_MINIMUM=3.5 cmake . -D BUILD_TEST=TRUE + && make -j4 && CTEST_OUTPUT_ON_FAILURE=1 make test" + + steps: + - name: Checkout tenseal v${{ env.TENSEAL_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: OpenMined/TenSEAL + ref: v${{ env.TENSEAL_VERSION }} + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch tenseal source + run: | + git apply python-wheels/patches/tenseal/${{ env.TENSEAL_VERSION }}/00*.patch + + - 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 }} + # MAKEFLAGS bounds setup.py's otherwise unbounded `make -j` to the runner's cores. + CIBW_ENVIRONMENT: >- + CMAKE_POLICY_VERSION_MINIMUM=3.5 + MAKEFLAGS=-j$(nproc) + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + CIBW_TEST_REQUIRES: numpy pytest scikit-image + # Staged so `import tenseal` resolves to the installed wheel, not the checkout. + CIBW_TEST_SOURCES: tests pytest.ini + # Upstream runs the C++ suite on one interpreter only. + CIBW_TEST_COMMAND: >- + python -c "import importlib.metadata as m; l = sorted(str(p).split('licenses/', 1)[1] for p in m.files('tenseal') if 'licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.gsl', 'LICENSE.nlohmann-json', 'LICENSE.protobuf', 'LICENSE.pybind11', 'LICENSE.seal', 'LICENSE.xsimd', 'LICENSE.xtensor', 'LICENSE.xtl', 'LICENSE.zlib', 'LICENSE.zstd'], l" + && pytest -m "not slow" -v tests/python/tenseal + && pytest -v tests/python/sealapi + ${{ matrix.python == 'cp314' && env.CPP_TESTS || '' }} + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: tenseal-${{ env.TENSEAL_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish tenseal ${{ 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: tenseal-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/tenseal.yaml b/docs/packages/tenseal.yaml new file mode 100644 index 000000000000..d3a631e0ba13 --- /dev/null +++ b/docs/packages/tenseal.yaml @@ -0,0 +1,6 @@ +package-name: tenseal +source-code: https://github.com/OpenMined/TenSEAL +license: Apache-2.0 +versions: +- version: 0.3.18 + patched: true diff --git a/patches/tenseal/0.3.18/0001-ship-the-licences-of-the-FetchContent-d-C-dependencies.patch b/patches/tenseal/0.3.18/0001-ship-the-licences-of-the-FetchContent-d-C-dependencies.patch new file mode 100644 index 000000000000..f1247ff2b71a --- /dev/null +++ b/patches/tenseal/0.3.18/0001-ship-the-licences-of-the-FetchContent-d-C-dependencies.patch @@ -0,0 +1,375 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Tue, 13 Oct 2026 12:00:00 +0200 +Subject: [PATCH] ship the licences of the FetchContent'd C++ dependencies in + the wheel's dist-info + +cmake/*.cmake FetchContent-downloads and compiles Microsoft SEAL v4.3.3 +(MIT), protobuf v3.15.8 (BSD-3-Clause), pybind11 v2.12.0 +(BSD-3-Clause), xtensor 0.23.5, xtl 0.7.2 and xsimd 7.4.10 (all +BSD-3-Clause) and nlohmann/json v3.9.1 (MIT) into _tenseal_cpp, +_sealapi_cpp and libtenseal.so. SEAL's own SEAL_BUILD_DEPS in turn +fetches Microsoft GSL 4.2.1 (MIT), zlib 1.3.2 (Zlib) and zstd 1.5.7 +(BSD-3-Clause) and merges zlib and zstd into its static archive. + +pyproject.toml lists `license-files = ["LICENSE"]`, so the wheel carries +only TenSEAL's own Apache-2.0 text. Reproduced against the real +tenseal-0.3.18-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl +from PyPI: dist-info/licenses/ holds LICENSE alone. + +Add each dependency's licence text unchanged from the pinned tag or +commit at the project root as LICENSE., and widen license-files to +pick them up. + +Upstream-Status: To upstream [not yet submitted; this port may only touch riseproject-dev/python-wheels] + +Signed-off-by: Ludovic Henry +--- + LICENSE.gsl | 21 +++++++++++++++++++++ + LICENSE.nlohmann-json | 21 +++++++++++++++++++++ + LICENSE.protobuf | 32 ++++++++++++++++++++++++++++++++ + LICENSE.pybind11 | 29 +++++++++++++++++++++++++++++ + LICENSE.seal | 21 +++++++++++++++++++++ + LICENSE.xsimd | 28 ++++++++++++++++++++++++++++ + LICENSE.xtensor | 28 ++++++++++++++++++++++++++++ + LICENSE.xtl | 30 ++++++++++++++++++++++++++++++ + LICENSE.zlib | 22 ++++++++++++++++++++++ + LICENSE.zstd | 30 ++++++++++++++++++++++++++++++ + pyproject.toml | 2 +- + 11 files changed, 263 insertions(+), 1 deletion(-) + +diff --git a/LICENSE.gsl b/LICENSE.gsl +new file mode 100644 +index 0000000..aa58667 +--- /dev/null ++++ b/LICENSE.gsl +@@ -0,0 +1,21 @@ ++Copyright (c) 2015 Microsoft Corporation. All rights reserved. ++ ++This code is licensed under the MIT License (MIT). ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ++of the Software, and to permit persons to whom the Software is furnished to do ++so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++THE SOFTWARE. +diff --git a/LICENSE.nlohmann-json b/LICENSE.nlohmann-json +new file mode 100644 +index 0000000..ffef714 +--- /dev/null ++++ b/LICENSE.nlohmann-json +@@ -0,0 +1,21 @@ ++MIT License ++ ++Copyright (c) 2013-2020 Niels Lohmann ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy ++of this software and associated documentation files (the "Software"), to deal ++in the Software without restriction, including without limitation the rights ++to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++copies of the Software, and to permit persons to whom the Software is ++furnished to do so, subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++SOFTWARE. +diff --git a/LICENSE.protobuf b/LICENSE.protobuf +new file mode 100644 +index 0000000..19b305b +--- /dev/null ++++ b/LICENSE.protobuf +@@ -0,0 +1,32 @@ ++Copyright 2008 Google Inc. All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are ++met: ++ ++ * Redistributions of source code must retain the above copyright ++notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above ++copyright notice, this list of conditions and the following disclaimer ++in the documentation and/or other materials provided with the ++distribution. ++ * Neither the name of Google Inc. nor the names of its ++contributors may be used to endorse or promote products derived from ++this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ++A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ++OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ++DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ++THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Code generated by the Protocol Buffer compiler is owned by the owner ++of the input file used when generating it. This code is not ++standalone and requires a support library to be linked with it. This ++support library is itself covered by the above license. +diff --git a/LICENSE.pybind11 b/LICENSE.pybind11 +new file mode 100644 +index 0000000..e466b0d +--- /dev/null ++++ b/LICENSE.pybind11 +@@ -0,0 +1,29 @@ ++Copyright (c) 2016 Wenzel Jakob , All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ ++1. Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++2. Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++3. Neither the name of the copyright holder nor the names of its contributors ++ may be used to endorse or promote products derived from this software ++ without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Please also refer to the file .github/CONTRIBUTING.md, which clarifies licensing of ++external contributions to this project including patches, pull requests, etc. +diff --git a/LICENSE.seal b/LICENSE.seal +new file mode 100644 +index 0000000..2107107 +--- /dev/null ++++ b/LICENSE.seal +@@ -0,0 +1,21 @@ ++ MIT License ++ ++ Copyright (c) Microsoft Corporation. All rights reserved. ++ ++ Permission is hereby granted, free of charge, to any person obtaining a copy ++ of this software and associated documentation files (the "Software"), to deal ++ in the Software without restriction, including without limitation the rights ++ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ copies of the Software, and to permit persons to whom the Software is ++ furnished to do so, subject to the following conditions: ++ ++ The above copyright notice and this permission notice shall be included in all ++ copies or substantial portions of the Software. ++ ++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ SOFTWARE +diff --git a/LICENSE.xsimd b/LICENSE.xsimd +new file mode 100644 +index 0000000..1b611d0 +--- /dev/null ++++ b/LICENSE.xsimd +@@ -0,0 +1,28 @@ ++Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Wolf Vollprecht and Martin Renou ++Copyright (c) 2016, QuantStack ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ ++* Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++* Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++* Neither the name of the copyright holder nor the names of its ++ contributors may be used to endorse or promote products derived from ++ this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/LICENSE.xtensor b/LICENSE.xtensor +new file mode 100644 +index 0000000..03d48a3 +--- /dev/null ++++ b/LICENSE.xtensor +@@ -0,0 +1,28 @@ ++Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht ++Copyright (c) 2016, QuantStack ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ ++* Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++* Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++* Neither the name of the copyright holder nor the names of its ++ contributors may be used to endorse or promote products derived from ++ this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/LICENSE.xtl b/LICENSE.xtl +new file mode 100644 +index 0000000..d553f7d +--- /dev/null ++++ b/LICENSE.xtl +@@ -0,0 +1,30 @@ ++BSD 3-Clause License ++ ++Copyright (c) 2017, Sylvain Corlay, Johan Mabille and Wolf Vollprecht ++Copyright (c) 2017, QuantStack ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ ++* Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++* Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++* Neither the name of the copyright holder nor the names of its ++ contributors may be used to endorse or promote products derived from ++ this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE ++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/LICENSE.zlib b/LICENSE.zlib +new file mode 100644 +index 0000000..b7a69d0 +--- /dev/null ++++ b/LICENSE.zlib +@@ -0,0 +1,22 @@ ++Copyright notice: ++ ++ (C) 1995-2026 Jean-loup Gailly and Mark Adler ++ ++ This software is provided 'as-is', without any express or implied ++ warranty. In no event will the authors be held liable for any damages ++ arising from the use of this software. ++ ++ Permission is granted to anyone to use this software for any purpose, ++ including commercial applications, and to alter it and redistribute it ++ freely, subject to the following restrictions: ++ ++ 1. The origin of this software must not be misrepresented; you must not ++ claim that you wrote the original software. If you use this software ++ in a product, an acknowledgment in the product documentation would be ++ appreciated but is not required. ++ 2. Altered source versions must be plainly marked as such, and must not be ++ misrepresented as being the original software. ++ 3. This notice may not be removed or altered from any source distribution. ++ ++ Jean-loup Gailly Mark Adler ++ jloup@gzip.org madler@alumni.caltech.edu +diff --git a/LICENSE.zstd b/LICENSE.zstd +new file mode 100644 +index 0000000..7580028 +--- /dev/null ++++ b/LICENSE.zstd +@@ -0,0 +1,30 @@ ++BSD License ++ ++For Zstandard software ++ ++Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without modification, ++are permitted provided that the following conditions are met: ++ ++ * Redistributions of source code must retain the above copyright notice, this ++ list of conditions and the following disclaimer. ++ ++ * Redistributions in binary form must reproduce the above copyright notice, ++ this list of conditions and the following disclaimer in the documentation ++ and/or other materials provided with the distribution. ++ ++ * Neither the name Facebook, nor Meta, nor the names of its contributors may ++ be used to endorse or promote products derived from this software without ++ specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ++ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ++ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +diff --git a/pyproject.toml b/pyproject.toml +index cd36177..a5282b1 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -7,7 +7,7 @@ name = "tenseal" + description = "A Library for Homomorphic Encryption Operations on Tensors" + readme = "README.md" + license = "Apache-2.0" +-license-files = ["LICENSE"] ++license-files = ["LICENSE", "LICENSE.*"] + requires-python = ">=3.11" + # tenseal.tensors.plaintensor imports numpy at module scope, so importing + # tenseal fails without it. Previously undeclared, which made a bare From 3db50b4105255cdbbc58b17529a7983c3122fabc Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 24 Oct 2026 01:12:25 +0000 Subject: [PATCH 2/3] tenseal: disable xtensor's xsimd backend on riscv64 xsimd 7.4.10 has no RISC-V backend, so XSIMD_DEFAULT_ALIGNMENT is 0 there and xsimd::aligned_allocator throws std::bad_alloc on every xtensor allocation: every PlainTensor/CKKSTensor/BFVTensor failed to construct in the Python test suite. Build without XTENSOR_USE_XSIMD on riscv64, and rerun the workflow when patches/tenseal/ changes. --- .github/workflows/build-tenseal.yml | 2 + ...e-xtensor-s-xsimd-backend-on-riscv64.patch | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 patches/tenseal/0.3.18/0002-do-not-enable-xtensor-s-xsimd-backend-on-riscv64.patch diff --git a/.github/workflows/build-tenseal.yml b/.github/workflows/build-tenseal.yml index d086058cf595..891280c02629 100644 --- a/.github/workflows/build-tenseal.yml +++ b/.github/workflows/build-tenseal.yml @@ -19,11 +19,13 @@ on: paths: - '.github/workflows/build-tenseal.yml' - 'docs/packages/tenseal.yaml' + - 'patches/tenseal/**' push: branches: [main] paths: - '.github/workflows/build-tenseal.yml' - 'docs/packages/tenseal.yaml' + - 'patches/tenseal/**' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} diff --git a/patches/tenseal/0.3.18/0002-do-not-enable-xtensor-s-xsimd-backend-on-riscv64.patch b/patches/tenseal/0.3.18/0002-do-not-enable-xtensor-s-xsimd-backend-on-riscv64.patch new file mode 100644 index 000000000000..6024f3813c2a --- /dev/null +++ b/patches/tenseal/0.3.18/0002-do-not-enable-xtensor-s-xsimd-backend-on-riscv64.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 24 Oct 2026 12:00:00 +0200 +Subject: [PATCH] do not enable xtensor's xsimd backend on riscv64 + +cmake/xtensor.cmake unconditionally defines XTENSOR_USE_XSIMD (and sets +the xtensor CMake option of the same name, which xtensor's interface +target also propagates as a compile definition). xtensor then allocates +every xarray buffer through xsimd::aligned_allocator. + +The pinned xsimd 7.4.10 only knows x86 and ARM instruction sets. On +riscv64 it detects none ("No SIMD instructions set detected" #warning) +and, with GCC >= 7, defines XSIMD_DEFAULT_ALIGNMENT to 0. +detail::xaligned_malloc() returns nullptr whenever the alignment is 0, +so aligned_allocator::allocate() throws std::bad_alloc on every +allocation: every TensorStorage, and therefore every PlainTensor, +CKKSTensor and BFVTensor, fails to construct, e.g. + + ts.plain_tensor([0]) -> MemoryError: std::bad_alloc + +Reproduced with a standalone program building +xt::xarray(xt::adapt(vector, shape)) against xtl 0.7.2, xsimd +7.4.10 and xtensor 0.23.5 under GCC 14 in manylinux_2_39_riscv64: it +throws std::bad_alloc with -DXTENSOR_USE_XSIMD and works without it. + +TenSEAL never uses xsimd directly, so on riscv64 leave XTENSOR_USE_XSIMD +off and let xtensor use std::allocator with its scalar code paths. +xsimd is still fetched and on the include path, so LICENSE.xsimd stays +in the wheel. + +Upstream-Status: To upstream [not yet submitted; this port may only touch riseproject-dev/python-wheels] + +Signed-off-by: Ludovic Henry +--- + cmake/xtensor.cmake | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/cmake/xtensor.cmake b/cmake/xtensor.cmake +index fe48ee0..281ae89 100644 +--- a/cmake/xtensor.cmake ++++ b/cmake/xtensor.cmake +@@ -1,7 +1,11 @@ + include(FetchContent) + +-add_definitions(-DXTENSOR_USE_XSIMD) +-set(XTENSOR_USE_XSIMD ON) ++# xsimd 7.x has no RISC-V backend: XSIMD_DEFAULT_ALIGNMENT is 0 there and ++# xsimd::aligned_allocator then throws std::bad_alloc on every allocation. ++if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv") ++ add_definitions(-DXTENSOR_USE_XSIMD) ++ set(XTENSOR_USE_XSIMD ON) ++endif() + set(JSON_BuildTests OFF) + set(JSON_Install OFF) + From 00a9c6bdcc21b5966174793fc373403baad14c52 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 25 Oct 2026 17:54:00 +0000 Subject: [PATCH 3/3] tenseal: pin CIBW_TEST_REQUIRES deps to our registry's riscv64 wheels scikit-image's pillow>=10.1 and the bare numpy dep both resolve to newer, riscv64-wheel-less PyPI sdist releases without this (gotcha 291): pillow's sdist build then fails outright with RequiredDependencyException: jpeg (no libjpeg headers in the manylinux image), and numpy burns ~20 minutes compiling from source before even getting there. PIP_ONLY_BINARY=numpy,pillow makes pip pick our registry's riscv64 wheels for both across every interpreter in the matrix. --- .github/workflows/build-tenseal.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-tenseal.yml b/.github/workflows/build-tenseal.yml index 891280c02629..dcdf1442465e 100644 --- a/.github/workflows/build-tenseal.yml +++ b/.github/workflows/build-tenseal.yml @@ -92,6 +92,7 @@ jobs: CMAKE_POLICY_VERSION_MINIMUM=3.5 MAKEFLAGS=-j$(nproc) PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY=numpy,pillow CIBW_TEST_REQUIRES: numpy pytest scikit-image # Staged so `import tenseal` resolves to the installed wheel, not the checkout. CIBW_TEST_SOURCES: tests pytest.ini