Skip to content
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

Update NPY001 rule for NumPy 2.0 #11735

Merged
merged 2 commits into from
Jun 4, 2024
Merged

Conversation

mtsokol
Copy link
Contributor

@mtsokol mtsokol commented Jun 4, 2024

Hi!

This PR addresses #11093.

It skips np.bool and np.long replacements as both of these names were reintroduced in NumPy 2.0 with a different meaning (numpy/numpy#24922, numpy/numpy#25080).
With this change NPY001 will no longer conflict with NPY201. For projects using NumPy 1.x np.bool and np.long has been deprecated and removed long time ago, and accessing them yields an informative error message.

Copy link
Contributor

github-actions bot commented Jun 4, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -1 violations, +0 -0 fixes in 1 projects; 49 projects unchanged)

bokeh/bokeh (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

- examples/server/app/selection_histogram.py:88:42: NPY001 [*] Type alias `np.bool` is deprecated, replace with builtin type

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
NPY001 1 0 1 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -1 violations, +0 -0 fixes in 1 projects; 49 projects unchanged)

bokeh/bokeh (+0 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

- examples/server/app/selection_histogram.py:88:42: NPY001 [*] Type alias `np.bool` is deprecated, replace with builtin type

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
NPY001 1 0 1 0 0

@charliermarsh charliermarsh self-assigned this Jun 4, 2024
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks!

@charliermarsh charliermarsh enabled auto-merge (squash) June 4, 2024 19:20
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jun 4, 2024
@charliermarsh charliermarsh merged commit 1645be0 into astral-sh:main Jun 4, 2024
17 checks passed
@mtsokol mtsokol deleted the update-npy001 branch June 4, 2024 19:24
Copy link

codspeed-hq bot commented Jun 4, 2024

CodSpeed Performance Report

Merging #11735 will degrade performances by 7.28%

Comparing mtsokol:update-npy001 (aaf4983) with mtsokol:update-npy001 (16738d5)

Summary

❌ 1 regressions
✅ 29 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark mtsokol:update-npy001 mtsokol:update-npy001 Change
linter/all-with-preview-rules[numpy/globals.py] 799.5 µs 862.2 µs -7.28%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants