Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
61 changes: 3 additions & 58 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
push:
branches:
- main
- master
tags:
- "*"
pull_request:
branches:
- main

workflow_dispatch:

permissions:
Expand Down Expand Up @@ -49,39 +51,6 @@ jobs:
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
- name: Test wheel install
if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
shell: bash
run: |
set -e
python3 -m pip install --upgrade pip
python3 -m pip install numpy pytest pytest-sugar
python3 -m pip install deepbiop --find-links dist --force-reinstall --no-deps --no-cache-dir
# Remove source deepbiop directory to prevent import conflicts
mv py-deepbiop/deepbiop py-deepbiop/deepbiop.bak
cd py-deepbiop && python3 -m pytest -vls
# Restore source directory
mv deepbiop.bak deepbiop
- name: Test wheel install
if: ${{ !startsWith(matrix.platform.target, 'x86') }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.target }}
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip
pip3 install -U pip
pip3 install numpy pytest pytest-sugar
run: |
set -e
pip3 install deepbiop --find-links dist --force-reinstall --no-deps --no-cache-dir
# Remove source deepbiop directory to prevent import conflicts
mv py-deepbiop/deepbiop py-deepbiop/deepbiop.bak
cd py-deepbiop && pytest -vls
# Restore source directory
mv deepbiop.bak deepbiop

windows:
runs-on: ${{ matrix.platform.runner }}
Expand All @@ -107,18 +76,6 @@ jobs:
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
- name: Test wheel install
shell: bash
run: |
set -e
python3 -m pip install --upgrade pip
python3 -m pip install numpy pytest pytest-sugar
python3 -m pip install deepbiop --find-links dist --force-reinstall --no-deps --no-cache-dir
# Remove source deepbiop directory to prevent import conflicts
mv py-deepbiop/deepbiop py-deepbiop/deepbiop.bak
cd py-deepbiop && python3 -m pytest -vls
# Restore source directory
mv deepbiop.bak deepbiop

macos:
runs-on: ${{ matrix.platform.runner }}
Expand All @@ -145,18 +102,6 @@ jobs:
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
- name: Test wheel install
if: ${{ !startsWith(matrix.platform.target, 'x86_64') }}
run: |
set -e
python3 -m pip install --upgrade pip
python3 -m pip install numpy pytest pytest-sugar
python3 -m pip install deepbiop --find-links dist --force-reinstall --no-deps --no-cache-dir
# Remove source deepbiop directory to prevent import conflicts
mv py-deepbiop/deepbiop py-deepbiop/deepbiop.bak
cd py-deepbiop && python3 -m pytest -vls
# Restore source directory
mv deepbiop.bak deepbiop

sdist:
runs-on: ubuntu-latest
Expand Down
142 changes: 142 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Test-Python

on:
push:
branches:
- main
pull_request:

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

jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal

- name: Install uv (Linux/macOS)
if: runner.os != 'Windows'
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install uv (Windows)
if: runner.os == 'Windows'
run: irm https://astral.sh/uv/install.ps1 | iex
shell: powershell

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
py-deepbiop/.venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-uv-${{ hashFiles('py-deepbiop/uv.lock') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-uv-

- name: Build Python package
working-directory: py-deepbiop
run: |
uv sync
uv tool run maturin develop --release

- name: Run Python tests
working-directory: py-deepbiop
run: uv run pytest -vls --tb=short

- name: Run Python tests with coverage (Linux only)
if: runner.os == 'Linux' && matrix.python-version == '3.10'
working-directory: py-deepbiop
run: |
uv run pytest --cov=deepbiop --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov (Linux only)
if: runner.os == 'Linux' && matrix.python-version == '3.10'
uses: codecov/codecov-action@v5
with:
files: py-deepbiop/coverage.xml
flags: python
name: python-${{ matrix.python-version }}
fail_ci_if_error: false

lint:
name: Lint Python code
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install dependencies
working-directory: py-deepbiop
run: |
uv sync
uv tool run maturin develop --release

- name: Run ruff check
working-directory: py-deepbiop
run: uvx ruff check .

- name: Run ruff format check
working-directory: py-deepbiop
run: uvx ruff format --check .

- name: Run interrogate (docstring coverage)
working-directory: py-deepbiop
run: uv run interrogate deepbiop/ tests/ -vv
17 changes: 1 addition & 16 deletions .github/workflows/test.yml → .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
name: CI-rust
name: Test-rust

on:
push:
branches:
- main
paths:
- src/**
- examples/**
- Cargo.toml
- .github/workflows/test.yml
- crates/*

pull_request:
branches:
- main
paths:
- src/**
- examples/**
- Cargo.toml
- .github/workflows/test.yml
- crates/*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
14 changes: 5 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.14.3
rev: v0.14.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
# Run the linter.
- id: ruff-check
args: [--fix, --unsafe-fixes]
# Run the formatter.
- id: ruff-format

# python docstring coverage checking
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pyo3-stub-gen = "0.17.0"
rand = "0.9"
rand_distr = "0.5"
rayon = { version = "1.11" }
rust-numpy = "0.22"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.23"
Expand Down
4 changes: 3 additions & 1 deletion crates/deepbiop-bam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ anyhow = { workspace = true }
noodles = { workspace = true }
pyo3 = { workspace = true, optional = true }
pyo3-stub-gen = { workspace = true, optional = true }
numpy = { workspace = true, optional = true }
flate2 = { workspace = true }
bstr = { workspace = true }
rayon = { workspace = true }
Expand All @@ -23,6 +24,7 @@ log = { workspace = true }
lexical = { workspace = true }

derive_builder = { workspace = true }
deepbiop-core = { workspace = true }
deepbiop-utils = { workspace = true }
deepbiop-fq = { workspace = true }

Expand All @@ -32,4 +34,4 @@ tempfile = { workspace = true }


[features]
python = ["dep:pyo3", "dep:pyo3-stub-gen"]
python = ["dep:pyo3", "dep:pyo3-stub-gen", "dep:numpy"]
Loading
Loading