Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimappers2-update #114

Merged
merged 10 commits into from
Jan 7, 2025
Merged
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
82 changes: 56 additions & 26 deletions .github/workflows/build-test-rust-minimappers2.yaml
Original file line number Diff line number Diff line change
@@ -4,41 +4,71 @@ on:
pull_request:
branches: [ "main" ]
paths:
- 'minimappers2/src/'
- 'minimappers2/Cargo.toml'
- minimappers2/src/
- minimappers2/Cargo.toml
- minimappers2/**
- .github/workflows/build-test-rust-minimappers2.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
RUST_BACKTRACE: 1
PYTHONUTF8: 1
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: minimappers2
shell: bash

jobs:
test:
runs-on: ubuntu-latest
test-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.12', '3.13']

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: cd minimappers2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Create virtual environment
env:
BIN: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }}
run: |
python -m venv .venv
echo "$GITHUB_WORKSPACE/minimappers2/.venv/$BIN" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/minimappers2/.venv" >> $GITHUB_ENV
- name: Set up Rust
run: rustup show

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: minimappers2
save-if: ${{ github.ref_name == 'main' }}

- name: Install Python dependencies
run: |
pip install uv
uv pip install maturin
- name: Install minimappers2
run: maturin develop

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose

build-manylinux-x64_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Test build
uses: messense/maturin-action@v1
env:
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2025-01-08
maturin-version: '1.8.0'
command: build
args: -m minimappers2/Cargo.toml
run: cargo test --verbose
229 changes: 164 additions & 65 deletions .github/workflows/create-python-release.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,185 @@
# Taken from Polar-rs github action

name: Create Python release
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github
#
name: CI

on:
push:
branches:
- main
- master
tags:
- py-*
- '*'
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
manylinux-x64_64:
runs-on: ubuntu-latest
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
- runner: ubuntu-22.04
target: s390x
- runner: ubuntu-22.04
target: ppc64le
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: '3.7'

- name: Publish wheel
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma
with:
rust-toolchain: nightly-2024-02-04
maturin-version: '1.6.0'
command: publish
args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin

# Needed for Docker on Apple M1
# manylinux-aarch64:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.7'
#
# - name: Publish wheel
# uses: messense/maturin-action@v1
# env:
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
# with:
# rust-toolchain: nightly-2023-01-19
# target: aarch64-unknown-linux-gnu
# maturin-version: '0.14.10'
# command: publish
# args: -m minimappers2/Cargo.toml --skip-existing -o wheels -u jguhlin
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: auto
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

# uncomment to build a universal2 wheel
# we don't run it because it is twice as big and not needed because we build for both architectures separately
# macos-aarch64-universal:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: '3.7'
musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
- runner: ubuntu-22.04
target: aarch64
- runner: ubuntu-22.04
target: armv7
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
manylinux: musllinux_1_2
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

# - name: Fix README symlink
# run: |
# rm py-polars/README.md
# cp README.md py-polars/README.md
# No support for minimap2 for windows

# - name: Set up Rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: nightly-2023-01-19
macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: 'true'
- name: Build free-threaded wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

# - name: Set up Rust targets
# run: rustup target add aarch64-apple-darwin
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cd minimappers2
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

# - name: Publish wheel
# uses: messense/maturin-action@v1
# env:
# MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }}
# with:
# maturin-version: '0.14.10'
# command: publish
# args: -m py-polars/Cargo.toml --no-sdist --universal2 -o wheels -i python -u ritchie46
release:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/py-') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
# Used to upload release artifacts
contents: write
# Used to generate artifact attestation
attestations: write
steps:
- uses: actions/download-artifact@v4
- run: cd minimappers2
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
2 changes: 2 additions & 0 deletions minimappers2/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 3 additions & 0 deletions minimappers2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pixi environments
.pixi
*.egg-info
1,151 changes: 828 additions & 323 deletions minimappers2/Cargo.lock

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions minimappers2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[package]
name = "minimappers2"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[lib]
name = "minimappers2"
crate-type = ["cdylib", "rlib"]

[dependencies]
minimap2 = { version = "0.1.18", features = ["simde"] }
minimap2-sys = { version = "0.1.19", features = ["simde"] }
minimap2 = { version = "0.1.23", features = ["simde"], path = ".." }
crossbeam = "0.8.4"
mimalloc = {version = "0.1", default-features = false }

pyo3 = { version = "0.21" }
polars = "0.40"
pyo3-polars = "0.14"
pyo3 = { version = "0.22" }
polars = "0.45"
pyo3-polars = "0.19"

[profile.release]
opt-level = 3
1,634 changes: 1,634 additions & 0 deletions minimappers2/Exampe.ipynb

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions minimappers2/example/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 3 additions & 0 deletions minimappers2/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pixi environments
.pixi
*.egg-info
4,929 changes: 2,152 additions & 2,777 deletions minimappers2/example/Exampe.ipynb

Large diffs are not rendered by default.

4,144 changes: 4,144 additions & 0 deletions minimappers2/example/pixi.lock

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions minimappers2/example/pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
authors = ["Joseph Guhlin <joseph.guhlin@gmail.com>"]
channels = ["conda-forge", "bioconda"]
description = "Add a short description here"
name = "example"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
maturin = ">=1.8.1,<2"
uv = ">=0.5.14,<0.6"
jupyter = ">=1.1.1,<2"
jupyterlab = ">=4.3.4,<5"
polars = ">=1.17.1,<2"
pandas = ">=2.2.3,<3"
pyarrow = ">=18.1.0,<19"
plotly = ">=5.24.1,<6"
needletail = ">=0.6.1,<0.7"
454 changes: 454 additions & 0 deletions minimappers2/pixi.lock

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions minimappers2/pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
authors = ["Joseph Guhlin <joseph.guhlin@gmail.com>"]
channels = ["conda-forge", "bioconda"]
description = "Add a short description here"
name = "minimappers2"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
uv = ">=0.5.14,<0.6"
maturin = ">=1.8.1,<2"
7 changes: 4 additions & 3 deletions minimappers2/pyproject.toml
Original file line number Diff line number Diff line change
@@ -13,16 +13,17 @@ license = { file = "LICENSE" }
description = "A Python wrapper for minimap2-rs"
keywords = ["minimap2", "bioinformatics", "alignment", "mapping"]
dependencies = [
"polars>=0.15.15",
"pyarrow>=10.0.1",
"polars>=1.19.0",
"pyarrow>=18.1.0",
]
version = "0.1.7"

[project.urls]
homepage = "https://github.com/jguhlin/minimap2-rs"
repository = "https://github.com/jguhlin/minimap2-rs"

[build-system]
requires = ["maturin>=0.14,<0.15"]
requires = ["maturin>=1.8"]
build-backend = "maturin"

[tool.maturin]
525 changes: 199 additions & 326 deletions minimappers2/src/lib.rs

Large diffs are not rendered by default.