--- id: sklearn-compat version: "0.1.6" license: unclear license_treatment: permissive maintenance: active --- # sklearn-compat — Ease support for compatible scikit-learn estimators across versions License: permissive · Maintenance: active · Downloads: 2.4M/mo ## 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 above — 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 pip install sklearn-compat uv add sklearn-compat poetry add sklearn-compat ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 2.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags scikit-learn version compatibility, sklearn private API wrapper, multi-version sklearn support, sklearn estimator compatibility, cross-version sklearn utilities, sklearn-compatible, version-compatibility [View on SkillFed](https://skillfed.io/packages/sklearn-compat) · [View on PyPI](https://pypi.org/project/sklearn-compat/)