Skip to content
Draft
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
194 changes: 194 additions & 0 deletions .github/workflows/build-tblite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `sdist` and `wheels` jobs of
# https://github.com/tblite/tblite/blob/v0.7.0/.github/workflows/wheel.yml
name: Build tblite wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/tblite.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-tblite.yml'
- 'docs/packages/tblite.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-tblite.yml'
- 'docs/packages/tblite.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: tblite
version: ${{ inputs.version }}

build_sdist:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build tblite ${{ matrix.version }} sdist
runs-on: ubuntu-latest

env:
TBLITE_VERSION: ${{ matrix.version }}

steps:
- name: Checkout tblite v${{ env.TBLITE_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: tblite/tblite
ref: v${{ env.TBLITE_VERSION }}
persist-credentials: false

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

# Replaces upstream's micromamba python-env.yaml with the same build tools from PyPI.
- name: Install Python
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: '3.12'
activate-environment: true
enable-cache: false

- name: Install LAPACK
run: |
sudo apt-get update
sudo apt-get install -y liblapack-dev

- name: Reorganize repository
run: |
git config user.email ""
git config user.name "dummy"
git am python-wheels/patches/tblite/${{ env.TBLITE_VERSION }}/*.patch
git subtree add --prefix python/subprojects/tblite . HEAD

- name: Build sdist
run: |
uv pip install build meson-python 'meson!=1.8.0' ninja cffi numpy setuptools
python -m build python/ --sdist --outdir dist -n -Cdist-args="--include-subprojects"

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tblite-${{ env.TBLITE_VERSION }}-sdist
path: dist/*.tar.gz
if-no-files-found: error

build_wheels:
needs: [setup, build_sdist]
if: needs.setup.outputs.versions != '[]'
name: Build tblite ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
python: ["cp312", "cp313", "cp314", "cp314t"]

env:
TBLITE_VERSION: ${{ matrix.version }}

steps:
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: tblite-${{ env.TBLITE_VERSION }}-sdist
path: dist/

- id: sdist_path
run: echo "path=$(echo dist/*.tar.gz)" >> "$GITHUB_OUTPUT"

- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
package-dir: ${{ steps.sdist_path.outputs.path }}
output-dir: wheelhouse/
only: ${{ matrix.python }}-manylinux_riscv64
env:
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_CONFIG_SETTINGS: setup-args="-Dtblite:openmp=false"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'auditwheel repair -w {dest_dir} {wheel} --exclude libgomp.so.1'
CIBW_BEFORE_ALL_LINUX: yum install -y lapack-devel
CIBW_ENVIRONMENT: >-
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
PIP_ONLY_BINARY=numpy
# Upstream's wheel smoke test plus the `pytest --pyargs tblite` run of its build.yml.
CIBW_TEST_REQUIRES: pytest ase
CIBW_TEST_COMMAND: >-
python -c "import tblite.interface" &&
pytest --pyargs tblite -v &&
python -c "import importlib.metadata as m; names = [p.name for p in m.files('tblite')]; assert 'LICENSE.lapack' in names and 'COPYING.LESSER' in names, names"

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

gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# auditwheel vendors the image's libgfortran runtime.
name: Collect GPL sources (gcc) for tblite ${{ matrix.version }}
runs-on: ubuntu-24.04-riscv

steps:
- name: Collect gcc source RPM from manylinux_riscv64
uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tblite-${{ matrix.version }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error

publish:
name: Publish tblite ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
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: tblite-${{ matrix.version }}-*-manylinux_riscv64
gpl-sources-artifact: tblite-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc
6 changes: 6 additions & 0 deletions docs/packages/tblite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package-name: tblite
source-code: https://github.com/tblite/tblite
license: LGPL-3.0-or-later
versions:
- version: 0.7.0
patched: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
From 5d543c494eabd3ff015fd9a26d5cf6d0c0c2b9db Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Wed, 14 Oct 2026 10:29:47 +0000
Subject: [PATCH] Ship tblite's and its bundled dependencies' licences in the
wheel

`license.text` is the legacy table form, and meson-python only writes
`dist-info/licenses/` for files listed in `project.license-files` (it has
no default glob), so the published wheels carry no licence text at all:
not tblite's own LGPL-3.0 COPYING/COPYING.LESSER, not those of the meson
subprojects statically linked into `_libtblite` (dftd4, s-dftd3 and ddx
under LGPL-3.0; mctc-lib, mstore, multicharge, jonquil and toml-f under
Apache-2.0/MIT), and not that of the reference LAPACK/BLAS libraries
`auditwheel repair` vendors into `tblite.libs/`.

Switch to the PEP 639 SPDX `license` string and list every one of those
files. The subproject paths resolve because meson-python configures the
project (downloading the wraps) before it validates the metadata, and
they are part of the `--include-subprojects` sdist. LICENSE.lapack is
Reference-LAPACK v3.12.0's LICENSE, the version of the manylinux_2_39
image's lapack/blas packages (3.12.0-7.el10).

Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against tblite/tblite]
---
python/LICENSE.lapack | 48 +++++++++++++++++++++++++++++++++++++++++++
python/pyproject.toml | 17 ++++++++++++++-
2 files changed, 64 insertions(+), 1 deletion(-)
create mode 100644 python/LICENSE.lapack

diff --git a/python/LICENSE.lapack b/python/LICENSE.lapack
new file mode 100644
index 0000000..96b04c9
--- /dev/null
+++ b/python/LICENSE.lapack
@@ -0,0 +1,48 @@
+Copyright (c) 1992-2023 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights
+ reserved.
+Copyright (c) 2000-2023 The University of California Berkeley. All
+ rights reserved.
+Copyright (c) 2006-2023 The University of Colorado Denver. All rights
+ reserved.
+
+$COPYRIGHT$
+
+Additional copyrights may follow
+
+$HEADER$
+
+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 listed
+ in this license in the documentation and/or other materials
+ provided with the distribution.
+
+- Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+The copyright holders provide no reassurances that the source code
+provided does not infringe any patent, copyright, or any other
+intellectual property rights of third parties. The copyright holders
+disclaim any liability to any recipient for claims brought against
+recipient by any third party for infringement of that parties
+intellectual property rights.
+
+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.
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 6f45cad..dfb38cd 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -12,7 +12,22 @@ name = "tblite"
version = "0.7.0"
description = "Light-weight tight-binding framework"
readme = "README.rst"
-license.text = "LGPL-3.0-or-later"
+license = "LGPL-3.0-or-later"
+license-files = [
+ "LICENSE.lapack",
+ "subprojects/tblite/COPYING",
+ "subprojects/tblite/COPYING.LESSER",
+ "subprojects/dftd4/COPYING",
+ "subprojects/dftd4/COPYING.LESSER",
+ "subprojects/s-dftd3/COPYING",
+ "subprojects/s-dftd3/COPYING.LESSER",
+ "subprojects/ddx/LICENSE.txt",
+ "subprojects/mctc-lib/LICENSE",
+ "subprojects/mstore/LICENSE",
+ "subprojects/multicharge/LICENSE",
+ "subprojects/jonquil/LICENSE-*",
+ "subprojects/toml-f/LICENSE-*",
+]
urls.repository = "https://github.com/tblite/tblite"
urls.documentation = "https://tblite.readthedocs.io"
classifiers = [
--
2.43.0

Loading