Skip to content
Merged
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
94 changes: 94 additions & 0 deletions .github/workflows/build-pytrec-eval-terrier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/terrierteam/pytrec_eval/blob/v0.5.10/.github/workflows/publish-to-pypi.yml
name: Build pytrec-eval-terrier wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'pytrec-eval-terrier version to build (git tag without leading v, e.g. 0.5.10)'
required: true
default: '0.5.10'
pull_request:
paths:
- '.github/workflows/build-pytrec-eval-terrier.yml'
- 'patches/pytrec-eval-terrier/**'

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

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

env:
# `inputs.version` is empty on pull_request events; default to 0.5.10 there.
PYTREC_EVAL_TERRIER_VERSION: ${{ inputs.version || '0.5.10' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

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

build_wheels:
needs: [setup]
name: Build pytrec-eval-terrier ${{ inputs.version || '0.5.10' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# Extension is a plain setuptools Extension (no limited-API build), so
# per-interpreter wheels like upstream's own (cp310..cp314, cp314t).
python: ["cp312", "cp313", "cp314", "cp314t"]

steps:
- name: Checkout pytrec_eval v${{ env.PYTREC_EVAL_TERRIER_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: terrierteam/pytrec_eval
ref: v${{ env.PYTREC_EVAL_TERRIER_VERSION }}
submodules: true
persist-credentials: false

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

- name: Patch pytrec_eval source
run: git apply python-wheels/patches/pytrec-eval-terrier/${{ env.PYTREC_EVAL_TERRIER_VERSION }}/*.patch

- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
env:
CIBW_ARCHS: riscv64
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# numpy/scipy (install_requires) have no riscv64 wheels on public
# PyPI but are published on our own registry, needed both to build
# the test venv and to satisfy the wheel's own install_requires.
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
# Same suite upstream's push.yml runs (pytest tests/*.py); named
# explicitly since pytrec_eval_tests.py doesn't match pytest's
# default collection glob for a bare directory.
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {package}/tests/pytrec_eval_tests.py

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pytrec-eval-terrier-${{ env.PYTREC_EVAL_TERRIER_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish pytrec-eval-terrier ${{ inputs.version || '0.5.10' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: pytrec-eval-terrier-${{ inputs.version || '0.5.10' }}-*-manylinux_riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 0ecf629011edc089211fe49a815619fb8c84aa1b Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Thu, 10 Sep 2026 08:06:34 +0200
Subject: [PATCH] Add LICENSE.trec_eval for the vendored trec_eval C sources

setup.py compiles trec_eval's C sources straight into the pytrec_eval_ext
extension (sources=['src/pytrec_eval.cpp'] + TREC_EVAL_SRC, where
TREC_EVAL_SRC lists every *.c in the trec_eval submodule/tarball) -- it is
the functional core, not an optional or system-linked dependency. Upstream
pins this to trec_eval v9.0.8 (REMOTE_TREC_EVAL_URI in setup.py, and the
trec_eval submodule here is pinned to the same tag), and the built wheel
carries only pytrec_eval-terrier's own MIT LICENSE (confirmed via the
released sdist's PKG-INFO: `License-File: LICENSE`, nothing else) -- the
same as every other platform wheel upstream's own CI publishes.

v9.0.8's individual .c files still carry Chris Buckley's original 2008
per-file header ("Permission is granted for use and modification of this
file for research, non-commercial purposes"). But usnistgov/trec_eval
added a repository-wide LICENSE.md in 2024 (first shipped in v10.0) whose
text explicitly states it covers "the code for the original trec_eval, up
to version 9" and relicenses the whole project, Buckley's code included,
as NIST public-service software: "You may use, copy, and distribute copies
of the software in any medium... You may improve, modify, and create
derivative works." That statement, from the project's current copyright
holders (Buckley's original copyright plus Ian Soboroff's NIST-employee
modifications), is the authoritative, current statement of terms -- more
so than a per-file comment two major versions stale. This patch ships that
text (verbatim from github.com/usnistgov/trec_eval's current LICENSE.md)
as LICENSE.trec_eval at the project root, where setuptools' default
license_files glob (LICEN[CS]E*) picks it up automatically alongside the
project's own LICENSE, same mechanism as the python-mecab-ko port's
LICENSE.mecab-ko.

Upstream-Status: To upstream [blocked: this port may only touch riseproject-dev/python-wheels]
---
LICENSE.trec_eval | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 LICENSE.trec_eval

diff --git a/LICENSE.trec_eval b/LICENSE.trec_eval
new file mode 100644
index 0000000..145e551
--- /dev/null
+++ b/LICENSE.trec_eval
@@ -0,0 +1,7 @@
+The code for the original trec_eval, up to version 9, are Copyright (C) 2008 Chris Buckley. Significant modifications have been done by Ian Soboroff as an employee of NIST. Other modifications and ongoing support are by Ian Soboroff and other contributors on https://github.com/usnistgov/trec_eval. trec_eval is now made available under the following license.
+
+NIST-developed software is provided by NIST as a public service. You may use, copy, and distribute copies of the software in any medium, provided that you keep intact this entire notice. You may improve, modify, and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the source of the software.
+
+NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE.
+
+You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property. The software developed by NIST employees is not subject to copyright protection within the United States.
\ No newline at end of file
--
2.50.1 (Apple Git-155)