sklearn-compat
Ease support for compatible scikit-learn estimators across versions
What it is and what it does
sklearn-compat is a small utility package that centralizes backward-compatible wrappers for scikit-learn's private developer APIs. It solves a specific problem for maintainers of scikit-learn-compatible third-party libraries: each time scikit-learn makes breaking changes to its internal utilities, those libraries have historically duplicated the same compatibility code. This package factors out those utilities into a single maintained source.
The package tracks scikit-learn's breaking changes across versions (currently supporting 1.2 and later) and provides stable import paths for functions that have moved, changed signatures, or been renamed. Developers can import from sklearn-compat instead of directly from scikit-learn's private modules, and the package handles version detection and fallbacks automatically.
Use it for:
- Maintain a scikit-learn-compatible estimator library that needs to support multiple scikit-learn versions without duplicating compatibility shims.
- Migrate code from scikit-learn 1.6+ where validate_data moved and force_all_finite was deprecated while keeping backward compatibility.
- Use DataFrame type-checking utilities consistently across scikit-learn versions where they were added at different times.
- Adapt test helpers like _convert_container that changed parameter names between scikit-learn versions without forking test code.
- Support multiple scikit-learn versions in a library without vendoring or maintaining your own compatibility layer.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides backward-compatible wrappers for scikit-learn private utilities across multiple versions, allowing third-party libraries to support scikit-learn >= 1.2 without duplicating compatibility code.
Yes, if you maintain a scikit-learn-compatible library. It eliminates duplicate compatibility code across projects and is actively maintained to track scikit-learn changes. For end users of scikit-learn itself, there is no direct benefit—install only if a dependency requires it.
Install
sklearn-compat on PyPI
pip
pip install sklearn-compatuv
uv add sklearn-compatpoetry
poetry add sklearn-compatInstalling sklearn-compat
Before you install
Low install friction with a single runtime dependency on scikit-learn. Active maintenance with a release 68 days ago and ongoing development.
License in practice
Permissive license allows use in both open-source and commercial projects without significant restrictions.
Quickstart
pip install sklearn-compat
from sklearn_compat.utils._dataframe import is_pandas_df
from sklearn_compat.utils.validation import validate_data
is_pandas_df(X)
X_validated = validate_data(estimator, X=X, ensure_all_finite=True)
Requires scikit-learn >= 1.2 to be installed; designed for library developers writing estimators, not end users.
Verify before relying
- Whether the package will continue tracking all future scikit-learn breaking changes beyond current releases
- Whether vendoring the package is recommended over the PyPI dependency for production use
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — scikit-learn |
| Maintenance | actively maintained — 68 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,353,710/month — #3,112 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sklearn_compat-0.1.6-py3-none-any.whl
Tags
More Physics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
sympySymPy is a Python library for symbolic…
permissive · top 1,000 on PyPI
pydicomPydicom reads, modifies, and writes DICOM…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
CoolPropCoolProp provides thermodynamic and transport…
permissive · top 5,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
sklearnA deprecated placeholder package that blocks…
unclear · top 5,000 on PyPI
scikerasSciKeras wraps Keras models to work with…
permissive · top 15,000 on PyPI
sklearndfWraps scikit-learn estimators to return pandas…
permissive · top 15,000 on PyPI
sklearn-crfsuitesklearn-crfsuite wraps CRFsuite (Conditional…
permissive · top 15,000 on PyPI
imbalanced-learnProvides re-sampling techniques to address…
permissive · top 5,000 on PyPI
sklearn2pmmlConverts fitted Scikit-Learn pipelines to PMML…
agpl · top 15,000 on PyPI
scikit-learn-stubsProvides type stubs for scikit-learn to enable…
permissive · top 15,000 on PyPI
scikit-learn-extraExtends scikit-learn with additional machine…
permissive · top 15,000 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI