Skip to content

Commit

Permalink
Add more functions to python bindings (get predefined converters, lis…
Browse files Browse the repository at this point in the history
…t, chain...), add tests for python bindings, improve tests of R bindings, migrate docs website framewrok from mdbook to mkdocs (looks better, much nicer to navigate, easier to setup, more functionalities), complete docs for python bindings
  • Loading branch information
vemonet committed Apr 3, 2024
1 parent ebfd551 commit 9e7d0e5
Show file tree
Hide file tree
Showing 63 changed files with 1,728 additions and 842 deletions.
199 changes: 90 additions & 109 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types:
- published
push:
tags:
- "v*.*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -18,11 +21,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install wasm-pack for JS
- name: Install wasm-pack
run: cargo install wasm-pack

- name: Setup NodeJS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -58,129 +61,107 @@ jobs:
- run: cargo publish
working-directory: ./lib

wheel_linux:
name: 🐍🐧 Build wheel for Linux
runs-on: ubuntu-latest
# Inspired by pydantic: https://github.com/pydantic/pydantic-core/blob/main/.github/workflows/ci.yml
build_wheels:
name: 🐍 Wheels for ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }})
strategy:
fail-fast: false
matrix:
architecture: [ "x86_64", "aarch64" ]
continue-on-error: true
os: [linux, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
# Using pypy when possible for performance
# manylinux for various platforms, plus x86_64 pypy
- os: linux
manylinux: auto
target: i686
- os: linux
manylinux: auto
target: aarch64 # -bit ARM
- os: linux
manylinux: auto
target: armv7 # 32-bit ARM
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: linux
manylinux: auto
target: ppc64le
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: linux
manylinux: auto
target: s390x
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: linux
manylinux: auto
target: x86_64
# musllinux
- os: linux
manylinux: musllinux_1_1
target: x86_64
- os: linux
manylinux: musllinux_1_1
target: aarch64
# MacOS
- os: macos
target: x86_64
- os: macos
target: aarch64
# Windows
# x86_64 pypy builds are not PGO optimized, i686 not supported by pypy, aarch64 only 3.11 and up, also not PGO optimized
# x86_64 pypy3.9 pypy3.10 failing due to ring
- os: windows
target: x86_64
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: windows
target: i686
python-architecture: x86
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: windows
target: aarch64
interpreter: 3.11 3.12

runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
if: matrix.os == 'linux' && matrix.target == 'aarch64'
with:
platforms: linux/${{ matrix.architecture }}
if: github.event_name == 'release' && matrix.architecture != 'x86_64'
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/manylinux_build.sh | sed 's/%for_each_version%/${{ github.event_name == 'release' || '' }}/g' > .github/workflows/manylinux_build_script.sh
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/manylinux_build_script.sh
if: github.event_name == 'release' || matrix.architecture == 'x86_64'
- uses: actions/upload-artifact@v4
with:
name: curies_wheel_${{ matrix.architecture }}_linux
path: target/wheels/*.whl
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: target/wheels
if: github.event_name == 'release'


wheel_linux_musl:
name: 🐍🐧 Build wheel for MUSL Linux
runs-on: ubuntu-latest
strategy:
matrix:
architecture:
- "x86_64"
# - "aarch64" # Takes too long (1h30)
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
with:
platforms: linux/${{ matrix.architecture }}
if: github.event_name == 'release' && matrix.architecture != 'x86_64'
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/musllinux_build.sh | sed 's/%for_each_version%/${{ github.event_name == 'release' || '' }}/g' > .github/workflows/musllinux_build_script.sh
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/musllinux_1_1_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/musllinux_build_script.sh
if: github.event_name == 'release' || matrix.architecture == 'x86_64'
- uses: actions/upload-artifact@v4
with:
name: curies_wheel_${{ matrix.architecture }}_linux_musl
path: target/wheels/*.whl

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages-dir: target/wheels
if: github.event_name == 'release'

platforms: linux/${{ matrix.target }}

wheel_mac:
name: 🐍🍎 Build wheel for MacOS
runs-on: macos-latest
env:
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer'
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
MACOSX_DEPLOYMENT_TARGET: '10.14'
steps:
- uses: actions/checkout@v4
- run: rustup update && rustup target add aarch64-apple-darwin
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
cache-dependency-path: '**/requirements.dev.txt'
- run: pip install -r python/requirements.dev.txt
- run: maturin build --release -m python/Cargo.toml
- run: pip install --no-index --find-links=target/wheels/ curies-rs
- run: rm -r target/wheels
- run: maturin build --release --target universal2-apple-darwin -m python/Cargo.toml
- run: maturin build --release -m python/Cargo.toml
if: github.event_name == 'release'
- run: maturin build --release --target aarch64-apple-darwin -m python/Cargo.toml
if: github.event_name == 'release'
- uses: actions/upload-artifact@v4
with:
name: curies_wheel_universal2_mac
path: target/wheels/*.whl
- name: Publish to PyPI
if: github.event_name == 'release'
run: pip install twine && twine upload target/wheels/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
python-version: '3.11'
architecture: ${{ matrix.python-architecture || 'x64' }}

- run: pip install -U twine 'ruff==0.1.3' typing_extensions
# generate self-schema now, so we don't have to do so inside docker in maturin build
# - run: python generate_self_schema.py

wheel_windows:
name: 🐍🪟 Build wheel for Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
python-version: "3.10"
cache: pip
cache-dependency-path: '**/requirements.dev.txt'
- run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
- run: pip install -r python/requirements.dev.txt
- run: maturin build --release -m python/Cargo.toml
- run: pip install --no-index --find-links=target/wheels/ curies-rs
- run: rm -r target/wheels
- run: maturin build --release -m python/Cargo.toml
- run: maturin sdist -m python/Cargo.toml
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9 pypy3.10' }}
rust-toolchain: stable
docker-options: -e CI
working-directory: python
# env:
# CFLAGS_aarch64_unknown_linux_gnu: -D__ARM_ARCH=8
# # NOTE: ring linux aarch64 error: https://github.com/briansmith/ring/issues/1728

- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} python/dist/
- run: twine check --strict python/dist/*

- uses: actions/upload-artifact@v4
with:
name: curies_wheel_x86_64_windows
path: target/wheels/*.whl
name: nanopub_wheel_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }}
path: python/dist

- name: Publish to PyPI
if: github.event_name == 'release'
run: pip install twine && twine upload target/wheels/*
# if: startsWith(github.ref, 'refs/tags/')
run: twine upload python/dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/manylinux_build.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/musllinux_build.sh

This file was deleted.

Loading

0 comments on commit 9e7d0e5

Please sign in to comment.