Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions .github/workflows/CI_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ jobs:
run: poetry run sphinx-build doc doc/_build

- name: Run pytest
run: poetry run pytest -s --cov=open_source_template --cov-fail-under=80
# run: poetry run pytest -s --cov=obsweatherscale --cov-fail-under=80
run: poetry run pytest -s --cov=obsweatherscale

- name: Run linter
run: poetry run pylint -rn --output-format=parseable open_source_template
run: poetry run pylint -rn --output-format=parseable obsweatherscale

- name: Run static checker
run: |
OUTPUT=$(poetry run mypy open_source_template 2>&1 || true)
OUTPUT=$(poetry run mypy obsweatherscale 2>&1 || true)
echo "$OUTPUT"
# Extract the error count from lines
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/docs_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will build and publish the documentation to the `gh-pages` branch of the
# repository when a new tag is added.
# It uses the `peaceiris/actions-gh-pages` action to handle the publishing.
#
# Copyright (c) 2025 MeteoSwiss, based on the workflow created by Michele Cattaneo; michele.cattaneo@meteoswiss.ch

name: docs_publish

on:
push:
branches: ['main']

jobs:

docs:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install poetry and python package
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install

- name: Build documentation
run: poetry run sphinx-build doc doc/_build

- name: Publish documentation
uses: peaceiris/actions-gh-pages@v3

with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: doc/_build/
force_orphan: true
4 changes: 3 additions & 1 deletion obsweatherscale/likelihoods/transformed_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _shaped_noise_covar(
def expected_log_prob(
self,
target: torch.Tensor,
input: MultivariateNormal,
input: MultivariateNormal, # pylint: disable=redefined-builtin
*params: Any,
**kwargs: Any,
) -> torch.Tensor:
Expand Down Expand Up @@ -138,6 +138,7 @@ def expected_log_prob(
# Handle NaN values if enabled
nan_policy = settings.observation_nan_policy.value()
if nan_policy == "mask":
# pylint: disable=protected-access
observed = settings.observation_nan_policy._get_observed(
target, input.event_shape
)
Expand Down Expand Up @@ -338,6 +339,7 @@ def forward(

# Remove NaN values if enabled
if settings.observation_nan_policy.value() == "mask":
# pylint: disable=protected-access
observed = settings.observation_nan_policy._get_observed(
target, output.event_shape
)
Expand Down
3 changes: 2 additions & 1 deletion obsweatherscale/models/gp_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(
likelihood: _GaussianLikelihoodBase,
mean_module: Mean,
covar_module: Kernel,
) -> None:
) -> None: # pylint: disable=arguments-differ
"""Initialize the GPModel.
Parameters
Expand All @@ -38,6 +38,7 @@ def __init__(
self.mean_module = mean_module
self.covar_module = covar_module

# pylint: disable=arguments-differ
def forward(self, x: torch.Tensor, **kwargs: Any) -> MultivariateNormal:
mean_x = self.mean_module(x)
covar_x = self.covar_module(x)
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ max-line-length = 120
# Minimum number of public methods for a class (see R0903).
min-public-methods = 0

[tool.pylint.messages_control]
disable = [
"too-many-arguments",
"too-many-positional-arguments",
"too-many-locals",
]

[tool.mypy]
ignore_missing_imports = true
disallow_untyped_defs = true
Expand Down