Skip to content

Commit e71d0b4

Browse files
authored
chore: update Codecov settings and fix pyright issues. (#1726)
* chore: update Codecov settings for coverage flags. - ignore local .claude folder * fix pyright issues
1 parent fa36b0f commit e71d0b4

File tree

8 files changed

+23
-8
lines changed

8 files changed

+23
-8
lines changed

.github/codecov.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ coverage:
2222
threshold: 2% # allow the coverage to drop by X%, and posting a success status
2323
if_ci_failed: error # will set the status to success only if the CI is successful, alternative: success
2424

25+
# Flag configuration for carryforward
26+
# - 'fast': coverage from fast tests (run on every PR)
27+
# - 'full': coverage from full test suite including slow tests (run on main)
28+
# carryforward ensures slow test coverage from main is included in PR reports
29+
flag_management:
30+
individual_flags:
31+
- name: fast
32+
paths:
33+
- sbi/
34+
carryforward: false
35+
- name: full
36+
paths:
37+
- sbi/
38+
carryforward: true
39+
2540
comment:
2641
layout: "diff, flags, files"
2742
behavior: default # update if exists, otherwise post new

.github/workflows/cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ jobs:
4747
run: uv run pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
4848

4949
- name: Upload coverage to Codecov
50-
uses: codecov/codecov-action@v4-beta
50+
uses: codecov/codecov-action@v4
5151
with:
5252
env_vars: OS,PYTHON
5353
file: ./coverage.xml
54-
flags: unittests
54+
flags: full
5555
name: codecov-sbi-all-cpu
5656
token: ${{ secrets.CODECOV_TOKEN }}
5757

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
with:
6262
env_vars: OS,PYTHON
6363
file: ./coverage.xml
64-
flags: unittests
64+
flags: fast
6565
name: codecov-sbi-fast-cpu
6666
token: ${{ secrets.CODECOV_TOKEN }}
6767

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,4 @@ uv.lock
105105

106106
# Serena cache
107107
.serena/
108+
.claude/

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ xfail_strict = true
157157
[tool.pyright]
158158
include = ["sbi"]
159159
exclude = ["**/__pycache__", "**/__node_modules__", ".git", "docs", "mkdocs", "tests"]
160-
python_version = "3.10"
160+
pythonVersion = "3.10"
161161
reportUnsupportedDunderAll = false
162162
reportGeneralTypeIssues = false
163163
reportInvalidTypeForm = false

sbi/analysis/plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ def _sbc_rank_plot(
15951595
if num_bins is None:
15961596
# Recommendation from Talts et al.
15971597
num_bins = num_sbc_runs // 20
1598+
assert isinstance(num_bins, int)
15981599

15991600
# Plot one row subplot for each parameter, different "methods" on top of each other.
16001601
if params_in_subplots:

sbi/inference/trainers/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ def __setstate__(self, state_dict: Dict):
12881288
state_dict: State to be restored.
12891289
"""
12901290
state_dict["_summary_writer"] = self._default_summary_writer()
1291-
self.__dict__ = state_dict
1291+
vars(self).update(state_dict)
12921292

12931293

12941294
def check_if_proposal_has_default_x(proposal: Any):

sbi/samplers/vi/vi_divergence_optimizers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,13 @@ def get_loss_stats(self) -> Tuple[Array, Array]:
327327

328328
def update(self, kwargs: Dict):
329329
"""Updates the hyperparameters and scheduler/optimizer kwargs"""
330-
# print(kwargs)
331-
paras = self.__dict__
332330
for key, val in kwargs.items():
333331
if key == "retain_graph":
334332
self.retain_graph = val
335333
if key == "learning_rate":
336334
self.learning_rate = val
337335
if key in self.HYPER_PARAMETERS:
338-
paras[key] = val
336+
setattr(self, key, val)
339337

340338
if key == "self":
341339
posterior = kwargs[key]

0 commit comments

Comments
 (0)