-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of bwapy (#1)
* feat: initial implementation of python bindings for `bwa aln`, `bwa mem`, and `bwa index`
- Loading branch information
Showing
42 changed files
with
63,004 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @nh13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: CI | ||
|
||
on: push | ||
env: | ||
POETRY_VERSION: 1.8 | ||
|
||
jobs: | ||
testing: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
PYTHON_VERSION: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Set up Python ${{matrix.PYTHON_VERSION}} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{matrix.PYTHON_VERSION}} | ||
|
||
- name: Get full Python version | ||
id: full-python-version | ||
shell: bash | ||
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | ||
|
||
- name: Install poetry | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install poetry==${{env.POETRY_VERSION}} | ||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Ensure cache is healthy | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
shell: bash | ||
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
|
||
- name: Check that the lock file is up to date | ||
shell: bash | ||
run: | | ||
poetry lock --check | ||
- name: Install deps | ||
shell: bash | ||
run: | | ||
poetry install | ||
- name: Style checking | ||
shell: bash | ||
run: | | ||
poetry run ruff format --check pybwa tests | ||
- name: Run lint | ||
shell: bash | ||
run: | | ||
poetry run ruff check pybwa tests | ||
- name: Run mypy | ||
shell: bash | ||
run: | | ||
poetry run mypy pybwa tests --config=pyproject.toml | ||
- name: Run pytest | ||
shell: bash | ||
run: | | ||
poetry run python -m pytest --cov=pybwa --cov-report=xml --cov-branch | ||
- name: Run docs | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
cd docs | ||
poetry run make html | ||
- name: Upload code coverage | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: publish pybwa | ||
|
||
on: | ||
push: | ||
tags: '\d+.\d+.\d+' | ||
|
||
env: | ||
POETRY_VERSION: 1.8.2 | ||
|
||
jobs: | ||
on-main-branch-check: | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
on_main: ${{ steps.contains_tag.outputs.retval }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: rickstaa/action-contains-tag@v1 | ||
id: contains_tag | ||
with: | ||
reference: "main" | ||
tag: "${{ github.ref_name }}" | ||
|
||
tests: | ||
name: tests | ||
needs: on-main-branch-check | ||
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }} | ||
uses: "./.github/workflows/tests.yml" | ||
|
||
build-wheels: | ||
name: build wheels | ||
needs: tests | ||
uses: "./.github/workflows/wheels.yml" | ||
|
||
build-sdist: | ||
name: build source distribution | ||
needs: tests | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install poetry | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install poetry==${{env.POETRY_VERSION}} | ||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-root --without=dev | ||
|
||
- name: Install project | ||
run: poetry install --no-interaction --without=dev | ||
|
||
- name: Build package | ||
run: poetry build --format=sdist | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: pybwa-sdist | ||
path: dist/*.tar.gz | ||
|
||
publish-to-pypi: | ||
runs-on: ubuntu-24.04 | ||
needs: [build-wheels, build-sdist] | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: packages | ||
pattern: 'pybwa-*' | ||
merge-multiple: true | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: packages/ | ||
skip-existing: true | ||
verbose: true | ||
|
||
make-changelog: | ||
runs-on: ubuntu-24.04 | ||
needs: publish-to-pypi | ||
outputs: | ||
release_body: ${{ steps.git-cliff.outputs.content }} | ||
steps: | ||
- name: Checkout the Repository at the Tagged Commit | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref_name }} | ||
|
||
- name: Generate a Changelog | ||
uses: orhun/git-cliff-action@v3 | ||
id: git-cliff | ||
with: | ||
config: pyproject.toml | ||
args: --latest --verbose | ||
env: | ||
GITHUB_REPO: ${{ github.repository }} | ||
|
||
make-github-release: | ||
runs-on: ubuntu-24.04 | ||
environment: github | ||
permissions: | ||
contents: write | ||
pull-requests: read | ||
needs: make-changelog | ||
steps: | ||
- name: Create Draft Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: ${{ github.ref_name }} | ||
body: ${{ needs.make-changelog.outputs.release_body }} | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: readthedocs/actions | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
documentation-links: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: readthedocs/actions/preview@v1 | ||
with: | ||
project-slug: "pybwa" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: build wheels | ||
|
||
on: | ||
pull_request: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-wheels: | ||
name: Build wheels for ${{ matrix.python }} | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
|
||
- name: Set up Python ${{ matrix.PYTHON_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Build wheels | ||
run: pip wheel --no-deps -w wheelhouse . | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pybwa-wheels-${{ matrix.python }} | ||
path: ./wheelhouse/pybwa*.whl | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "bwa"] | ||
path = bwa | ||
url = https://github.com/lh3/bwa.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: 2 | ||
build: | ||
os: ubuntu-24.04 | ||
tools: | ||
python: "3.9" | ||
jobs: | ||
pre_install: | ||
- pip install poetry==1.8.3 | ||
- poetry config virtualenvs.create false | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install | ||
submodules: | ||
include: all | ||
sphinx: | ||
configuration: docs/conf.py | ||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
# bwapy | ||
[![Language][language-badge]][language-link] | ||
[![Code Style][code-style-badge]][code-style-link] | ||
[![Type Checked][type-checking-badge]][type-checking-link] | ||
[![PEP8][pep-8-badge]][pep-8-link] | ||
[![Code Coverage][code-coverage-badge]][code-coverage-link] | ||
[![License][license-badge]][license-link] | ||
|
||
|
||
[language-badge]: http://img.shields.io/badge/language-python-brightgreen.svg | ||
[language-link]: http://www.python.org/ | ||
[code-style-badge]: https://img.shields.io/badge/code%20style-black-000000.svg | ||
[code-style-link]: https://black.readthedocs.io/en/stable/ | ||
[type-checking-badge]: http://www.mypy-lang.org/static/mypy_badge.svg | ||
[type-checking-link]: http://mypy-lang.org/ | ||
[pep-8-badge]: https://img.shields.io/badge/code%20style-pep8-brightgreen.svg | ||
[pep-8-link]: https://www.python.org/dev/peps/pep-0008/ | ||
[code-coverage-badge]: https://codecov.io/gh/fulcrumgenomics/pybwa/branch/main/graph/badge.svg | ||
[code-coverage-link]: https://codecov.io/gh/fulcrumgenomics/pybwa | ||
[license-badge]: http://img.shields.io/badge/license-MIT-blue.svg | ||
[license-link]: https://github.com/fulcrumgenomics/pybwa/blob/main/LICENSE | ||
|
||
# pybwa | ||
|
||
Python language bindings for [bwa][bwa-link]. | ||
|
||
See documentation on [pybwa.readthedocs.org][rtd-link]. | ||
|
||
[rtd-link]: http://pybwa.readthedocs.org/en/stable | ||
[bwa-link]: https://github.com/lh3/bwa |
Oops, something went wrong.