Skip to content

Conversation

@C1587S
Copy link
Contributor

@C1587S C1587S commented Jul 23, 2025

Summary

Updates statsmodels from 0.14.4 to 0.14.5 to resolve import failures with scipy 1.16.0+.

The issue occurred because scipy 1.16.0 removed the internal _lazywhere function from scipy._lib._util, which statsmodels 0.14.4 was importing. This caused ImportError: cannot import name '_lazywhere' when importing statsmodels.formula.api, breaking the damage function modeling in src/dscim/utils/utils.py.

Statsmodels 0.14.5 specifically addresses this compatibility issue and allows the codebase to work with current scipy versions.

Checks

  • Verified local compatibility with Python 3.11 + scipy 1.16.0
  • All affected tests pass:
    • tests/test_fair_estimations.py
    • tests/test_fair_utils.py
      Added compatibility test script to prevent future regs: test/test_statsmodels_scipy_compatibility.py

@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.94%. Comparing base (8dae2fe) to head (2331872).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #429   +/-   ##
=======================================
  Coverage   68.94%   68.94%           
=======================================
  Files          15       15           
  Lines        1755     1755           
=======================================
  Hits         1210     1210           
  Misses        545      545           

☔ 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.

@C1587S
Copy link
Contributor Author

C1587S commented Jul 24, 2025

The unit test was removed because it wasn’t aligned with the purpose of testing the library itself, and the relevant imports are already covered in other existing tests.

@C1587S C1587S merged commit 1d07c3c into main Jul 24, 2025
4 checks passed
@C1587S C1587S deleted the fix/statsmodels-scipy-compatibility branch July 24, 2025 05:00
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.

2 participants