Skip to content

Commit

Permalink
Merge branch 'main' into 426-further-prune-postprocessing-code-specif…
Browse files Browse the repository at this point in the history
…ically-plot_posterior-and-spread_draws
  • Loading branch information
dylanhmorris authored Oct 2, 2024
2 parents eb2559c + 20df5b3 commit 90bd604
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 67 deletions.
42 changes: 1 addition & 41 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,7 @@ permissions:
id-token: write

jobs:
render-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: quarto-dev/quarto-actions/setup@v2

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: install poetry
run: pip install poetry

- name: install package
run: poetry install --with docs

# This section renders the quarto documents (and the README file)
# and moves them to the docs/source/_compiled_qmd directory
# which is then uploaded as an artifact.
- name: Render documents
run: |
cd docs
poetry run make tutorials_clean
poetry run make tutorials_md
# Upload
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tutorials
path: docs/source/tutorials

build:
needs: render-docs
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -75,17 +41,11 @@ jobs:
run: |
cp README.md docs/source/index.md
# Download the rendered tutorials
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: tutorials
path: docs/source/tutorials/

# Building
- name: Build HTML using Poetry
run: |
cd docs
poetry run make tutorials_clean
poetry run make html
# Upload
Expand Down
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,17 @@ repos:
language: script
always_run: true
files: "docs/source/tutorials/.*(qmd|md)$"
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
args: ["--line-length", "79"]
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", "--line-length", "79"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.0
rev: v0.6.8
hooks:
# Sort imports
- id: ruff
args: ['check', '--select', 'I', '--fix']
# Run the linter
- id: ruff
# Run the formatter
- id: ruff-format
args: ['--line-length', '79']
- repo: https://github.com/numpy/numpydoc
rev: v1.7.0
hooks:
Expand Down
1 change: 0 additions & 1 deletion pyrenew/datasets/wastewater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This module loads the package dataset named 'wastewater' and provides functions to manipulate the data. It uses the 'polars' library.
"""


from importlib.resources import files

import polars as pl
Expand Down
1 change: 1 addition & 0 deletions pyrenew/distutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
found in renewal equation modeling,
such as discrete time-to-event distributions
"""

from __future__ import annotations

import jax.numpy as jnp
Expand Down
3 changes: 1 addition & 2 deletions test/test_forecast.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# numpydoc ignore=GL08

from test.utils import SimpleRt

import jax.numpy as jnp
import jax.random as jr
import numpyro
Expand All @@ -17,6 +15,7 @@
from pyrenew.model import RtInfectionsRenewalModel
from pyrenew.observation import PoissonObservation
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt


def test_forecast():
Expand Down
1 change: 1 addition & 0 deletions test/test_integrate_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Test the integrate_discrete function
used in DifferencedProcess and elsewhere
"""

import jax
import jax.numpy as jnp
import pytest
Expand Down
3 changes: 1 addition & 2 deletions test/test_latent_admissions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# numpydoc ignore=GL08

from test.utils import SimpleRt

import jax.numpy as jnp
import numpy.testing as testing
import numpyro
Expand All @@ -10,6 +8,7 @@
from pyrenew.deterministic import DeterministicPMF, DeterministicVariable
from pyrenew.latent import HospitalAdmissions, Infections
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt


def test_admissions_sample():
Expand Down
3 changes: 1 addition & 2 deletions test/test_latent_infections.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# numpydoc ignore=GL08

from test.utils import SimpleRt

import jax.numpy as jnp
import numpy.testing as testing
import numpyro
import pytest

from pyrenew.latent import Infections
from test.utils import SimpleRt


def test_infections_as_deterministic():
Expand Down
3 changes: 1 addition & 2 deletions test/test_model_basic_renewal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# numpydoc ignore=GL08

from test.utils import SimpleRt

import jax.numpy as jnp
import jax.random as jr
import numpy as np
Expand All @@ -18,6 +16,7 @@
from pyrenew.model import RtInfectionsRenewalModel
from pyrenew.observation import PoissonObservation
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt


def test_model_basicrenewal_no_timepoints_or_observations():
Expand Down
3 changes: 1 addition & 2 deletions test/test_model_hosp_admissions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# numpydoc ignore=GL08

from test.utils import SimpleRt

import jax.numpy as jnp
import jax.random as jr
import numpy as np
Expand All @@ -23,6 +21,7 @@
from pyrenew.model import HospitalAdmissionsModel
from pyrenew.observation import PoissonObservation
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt


def test_model_hosp_no_timepoints_or_observations():
Expand Down
3 changes: 1 addition & 2 deletions test/test_predictive.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
when no posterior samples are available.
"""

from test.utils import SimpleRt

import jax.numpy as jnp
import numpyro.distributions as dist
import pytest
Expand All @@ -18,6 +16,7 @@
from pyrenew.model import RtInfectionsRenewalModel
from pyrenew.observation import PoissonObservation
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt

pmf_array = jnp.array([0.25, 0.1, 0.2, 0.45])
gen_int = DeterministicPMF(name="gen_int", value=pmf_array)
Expand Down
3 changes: 1 addition & 2 deletions test/test_random_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
with different random keys behave appropriately.
"""

from test.utils import SimpleRt

import jax.numpy as jnp
import jax.random as jr
import numpyro
Expand All @@ -20,6 +18,7 @@
from pyrenew.model import RtInfectionsRenewalModel
from pyrenew.observation import PoissonObservation
from pyrenew.randomvariable import DistributionalVariable
from test.utils import SimpleRt


def create_test_model(): # numpydoc ignore=GL08
Expand Down
1 change: 1 addition & 0 deletions test/test_scan_rv_plate_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
classes behave as expected in a
:func:`numpyro.plate` context.
"""

import jax.numpy as jnp
import numpyro
import numpyro.distributions as dist
Expand Down

0 comments on commit 90bd604

Please sign in to comment.