Skip to content

Fix: Replace np.bool_ with np_bool in _ranking.py #31612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

MauryaGhogare
Copy link

This PR replaces deprecated np.bool_ with the compatible internal alias np_bool in _ranking.py.

  • Fixes linting issues flagged by Ruff (I001, F401)
  • Fixes mypy error: Module "sklearn.utils._array_api" has no attribute "bool"

This is part of scikit-learn's ongoing cleanup for NumPy compatibility.

Copy link

github-actions bot commented Jun 20, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: cd16843. Link to the linter CI: here

@MauryaGhogare
Copy link
Author

Hi! This PR replaces deprecated np.bool_ with np_bool in _ranking.py to align with NumPy 1.24+ compatibility. All lint and mypy errors are fixed. Looking forward to your review. Thanks!

Copy link
Contributor

@StefanieSenger StefanieSenger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MauryaGhogare,
thanks for your efforts. I’m not sure this change is necessary since numpy 1.24 is already quite old (our minimum supported version is 1.22), and we would have seen deprecation warnings if action was needed.

Also this fix causes some tests to fail instead of pass. Given that, I suggest we close this PR for now.

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

Successfully merging this pull request may close these issues.

2 participants