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
179 changes: 179 additions & 0 deletions .github/workflows/release-pyapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Deploy Maturin wheels

on:
push:
tags:
- "*"
workflow_dispatch:

permissions:
contents: read

jobs:
set-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION_WORKFLOWS }}
- name: Install tomlkit
run: pip install tomlkit
- name: Bump versions
run: python crates/bump-versions.py ${{ github.ref_name }}
- name: Upload patched Cargo files
uses: actions/upload-artifact@v4
with:
name: patched-cargo
path: |
Cargo.toml
crates/**/Cargo.toml

linux:
runs-on: ${{ matrix.platform.runner }}
needs: [set-version]
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- name: Download patched Cargo files
uses: actions/download-artifact@v4
with:
name: patched-cargo
path: .
- name: Install 32-bit glibc headers (x86 only)
if: matrix.platform.target == 'x86'
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION_WORKFLOWS }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter -m crates/ekore_py/Cargo.toml
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
needs: [set-version]
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- name: Download patched Cargo files
uses: actions/download-artifact@v4
with:
name: patched-cargo
path: .
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION_WORKFLOWS }}
architecture: ${{ matrix.platform.target }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter -m crates/ekore_py/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
needs: [set-version]
strategy:
matrix:
platform:
- runner: macos-latest
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- name: Download patched Cargo files
uses: actions/download-artifact@v4
with:
name: patched-cargo
path: .
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION_WORKFLOWS }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter -m crates/ekore_py/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
needs: [set-version]
steps:
- uses: actions/checkout@v4
- name: Download patched Cargo files
uses: actions/download-artifact@v4
with:
name: patched-cargo
path: .
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist -m crates/ekore_py/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
skip-existing: true
25 changes: 25 additions & 0 deletions .github/workflows/unittests-pyapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python-API unit tests

on: push

jobs:
test-pyapi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION_WORKFLOWS }}
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Create virtual environment
run: python -m venv .venv
- name: Add venv to PATH
run: echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- name: Install task runner and test deps
run: pip install maturin numpy poethepoet pytest
- name: Run Python-API tests
run: |
poe build-pyapi
poe ptest
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ We may prefix the items to signal the scope:

Items without prefix refer to a global change.

## [Unreleased](https://github.com/NNPDF/eko/compare/v0.15.4...HEAD)
## [Unreleased](https://github.com/NNPDF/eko/compare/v0.15.5...HEAD)

### Added
- rust: `ekore_py` crate, which exposes `ekore` crate as a Python bindings ([#554](https://github.com/NNPDF/eko/pull/554))

## [0.15.5](https://github.com/NNPDF/eko/compare/v0.15.4...v0.15.5) - 2026-07-22

### Added
- rust: `ekore_capi` crate, which exposes `ekore` crate as a C-ABI for other languages ([#537](https://github.com/NNPDF/eko/pull/537))
Expand Down
113 changes: 110 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ lz4_flex = "0.11.6"
ndarray = "0.15.4"
ndarray-npy = "0.8.1"
num = "0.4.1"
numpy = "0.29.0"
pyo3 = "0.29.0"
tar = "0.4.46"
thiserror = "1.0.63"
yaml-rust2 = "0.8"
Expand Down
Loading
Loading