Skip to content

Add Python interface #113

Add Python interface

Add Python interface #113

name: leapfrog-py test
on:
pull_request:
branches:
- "*"
push:
branches:
- main
jobs:
run:
runs-on: ${{ matrix.config.os }}
name: ${{matrix.config.os }} (${{ matrix.config.py }})
strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, py: '3.13'}
- {os: ubuntu-latest, py: '3.10'}
- {os: ubuntu-latest, py: '3.11'}
- {os: ubuntu-latest, py: '3.12'}
- {os: ubuntu-latest, py: '3.13'}
- {os: windows-latest, py: '3.13'}
defaults:
run:
working-directory: leapfrog-py
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "leapfrog-py/uv.lock"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config.py }}
- name: Extract test data
shell: bash
run: ../inst/standalone_model/extract_data
# We need to install R to run the test to compare R and Python output
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
extra-repositories: https://mrc-ide.r-universe.dev
working-directory: .
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: docopt, local::.
working-directory: .
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests & coverage
run: uv run pytest --cov --cov-report=xml --cov-config=pyproject.toml
- name: Lint
run: |
uvx ruff check .
uv run --group check mypy --install-types --non-interactive src tests
- name: Test install
run: |
pip install .
python -c "import leapfrog_py;"
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
# This can be useful, but the false positive rate is
# annoyingly high.
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}