Skip to content

Fix APLR wrappers' MRO with current aplr releases - #685

Merged
paulbkoch merged 1 commit into
interpretml:mainfrom
raashish1601:fix/aplr-mro
Oct 8, 2026
Merged

paulbkoch merged 1 commit into
interpretml:mainfrom
raashish1601:fix/aplr-mro

Conversation

@raashish1601

Copy link
Copy Markdown
Contributor

Recent aplr releases (10.27.0 here) make aplr.APLRRegressor and aplr.APLRClassifier subclasses of scikit-learn's RegressorMixin/ClassifierMixin and BaseEstimator. On main the wrappers list those sklearn classes before the native class:

class APLRRegressor(_SKRegressorMixin, LocalExplainer, GlobalExplainer, _SKBaseEstimator, APLRRegressorNative):

so Python can't build an MRO and import interpret.glassbox fails for anyone with a current aplr installed:

TypeError: Cannot create a consistent method resolution
order (MRO) for bases RegressorMixin, LocalExplainer, GlobalExplainer, BaseEstimator, APLRRegressor

This is also why the scheduled interpret-CI runs on main currently fail at test collection.

The native class now comes first, as it did in 0.7.8 (class APLRRegressor(APLRRegressorNative, RegressorMixin, ExplainerMixin)). This works whether or not the native class already derives from the sklearn classes, and with the stub used when aplr isn't installed. The wrappers' own methods still take precedence, and get_params/set_params already call the native class explicitly.

Tests: with aplr 10.27.0, tests/glassbox/test_aplr.py fails to collect on main and passes with this change (69 passed, 43 skipped together with test_aplr_utils.py). ruff format is clean.

Signed-off-by: Raashish Aggarwal <94279692+raashish1601@users.noreply.github.com>
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.21%. Comparing base (560f8dd) to head (c559258).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #685   +/-   ##
=======================================
  Coverage   67.21%   67.21%           
=======================================
  Files          77       77           
  Lines       11735    11735           
=======================================
  Hits         7888     7888           
  Misses       3847     3847           
Flag Coverage Δ
bdist_linux_311_python 66.95% <ø> (-0.03%) ⬇️
bdist_linux_312_python 66.95% <ø> (-0.03%) ⬇️
bdist_linux_313_python 66.95% <ø> (-0.03%) ⬇️
bdist_linux_314_python 66.87% <ø> (-0.01%) ⬇️
bdist_linuxarm_311_python 66.98% <ø> (ø)
bdist_linuxarm_312_python 66.97% <ø> (-0.02%) ⬇️
bdist_linuxarm_313_python 66.97% <ø> (-0.02%) ⬇️
bdist_linuxarm_314_python 66.89% <ø> (ø)
bdist_mac_311_python 67.11% <ø> (-0.02%) ⬇️
bdist_mac_312_python 67.13% <ø> (ø)
bdist_mac_313_python 67.09% <ø> (-0.04%) ⬇️
bdist_mac_314_python 67.03% <ø> (ø)
bdist_win_311_python 67.13% <ø> (-0.03%) ⬇️
bdist_win_312_python 67.13% <ø> (-0.02%) ⬇️
bdist_win_313_python 67.13% <ø> (-0.03%) ⬇️
bdist_win_314_python 67.02% <ø> (-0.04%) ⬇️
sdist_linux_311_python 66.91% <ø> (-0.01%) ⬇️
sdist_linux_312_python 66.90% <ø> (-0.03%) ⬇️
sdist_linux_313_python 66.90% <ø> (-0.03%) ⬇️
sdist_linux_314_python 66.80% <ø> (-0.03%) ⬇️
sdist_linuxarm_311_python 66.92% <ø> (ø)
sdist_linuxarm_312_python 66.89% <ø> (-0.04%) ⬇️
sdist_linuxarm_313_python 66.91% <ø> (-0.02%) ⬇️
sdist_linuxarm_314_python 66.81% <ø> (-0.02%) ⬇️
sdist_mac_311_python 67.03% <ø> (-0.02%) ⬇️
sdist_mac_312_python 67.04% <ø> (ø)
sdist_mac_313_python 67.03% <ø> (-0.02%) ⬇️
sdist_mac_314_python 66.93% <ø> (-0.02%) ⬇️
sdist_win_311_python 67.14% <ø> (ø)
sdist_win_312_python 67.14% <ø> (ø)
sdist_win_313_python 67.13% <ø> (-0.02%) ⬇️
sdist_win_314_python 67.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@raashish1601

Copy link
Copy Markdown
Contributor Author

The test_powerlift failure isn't from this change: it fails the same way on main (scheduled run 37461974875, job 112265538002). sqlalchemy_utils still subclasses sqlalchemy.orm.attributes.ScalarAttributeImpl, which newer SQLAlchemy renamed to _ScalarAttributeImpl, so the powerlift conftest fails to import. The other test jobs that have finished pass with this change, while on main they fail at collection on the APLR import.

@paulbkoch
paulbkoch merged commit ad09908 into interpretml:main Oct 8, 2026
66 of 68 checks passed
@paulbkoch

Copy link
Copy Markdown
Collaborator

Thanks @raashish1601!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants