Skip to content

fix: SDiD plot() API and sdid_pymc notebook ruff compliance#919

Merged
drbenvincent merged 2 commits into
mainfrom
fix/sdid-pymc-notebook-ruff
May 15, 2026
Merged

fix: SDiD plot() API and sdid_pymc notebook ruff compliance#919
drbenvincent merged 2 commits into
mainfrom
fix/sdid-pymc-notebook-ruff

Conversation

@drbenvincent
Copy link
Copy Markdown
Collaborator

@drbenvincent drbenvincent commented May 15, 2026

Summary

  • Add the missing public plot() on SyntheticDifferenceInDifferences, delegating to _render_plot, so integration tests and callers match the Make plot() args and kwargs visible in API docs (umbrella) #886 experiment contract (and the SDiD docs notebook).
  • Apply Ruff/import-order fixes in docs/source/notebooks/sdid_pymc.ipynb so pre-commit.ci passes on merge previews.
  • Register SyntheticDifferenceInDifferences in test_public_plot_signatures.py so the subclass is covered by the explicit-plot() invariant.

Context

main could fail test (3.14) with AttributeError: ... no attribute 'plot' even though SDiD already implemented _bayesian_plot; this PR completes the public API.

Test plan

  • prek run on touched Python files
  • pytest causalpy/tests/test_integration_pymc_examples.py::test_sdid causalpy/tests/test_integration_pymc_examples.py::test_sdid_datetime_index_and_effect_summary causalpy/tests/test_public_plot_signatures.py
  • CI green (including required prek / test (3.14))

Apply isort-aligned imports and drop an unused test-module import so pre-commit (including merge-preview runs) passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

SDiD had _bayesian_plot only; integration tests call result.plot().
Register the class in the plot-signature allowlist from #886.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drbenvincent drbenvincent changed the title style: fix ruff in sdid_pymc notebook fix: SDiD plot() API and sdid_pymc notebook ruff compliance May 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.05%. Comparing base (f3fe1e7) to head (e16f286).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #919      +/-   ##
==========================================
+ Coverage   94.87%   95.05%   +0.17%     
==========================================
  Files          85       87       +2     
  Lines       13174    13644     +470     
  Branches      793      807      +14     
==========================================
+ Hits        12499    12969     +470     
  Misses        479      479              
  Partials      196      196              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@drbenvincent drbenvincent merged commit 5fcaa21 into main May 15, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant