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

Add more lints to Ruff for better code quality. #621

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

hameerabbasi
Copy link
Collaborator

@hameerabbasi hameerabbasi commented Jan 8, 2024

This PR also adds lints that check for NumPy 2.0 compatibility.

sparse/_utils.py Dismissed Show dismissed Hide dismissed
sparse/_utils.py Dismissed Show dismissed Hide dismissed
Copy link

codecov bot commented Jan 8, 2024

Codecov Report

Merging #621 (f403a0f) into master (d6d1b19) will increase coverage by 0.11%.
The diff coverage is 79.05%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #621      +/-   ##
==========================================
+ Coverage   90.36%   90.48%   +0.11%     
==========================================
  Files          20       20              
  Lines        3603     3573      -30     
==========================================
- Hits         3256     3233      -23     
+ Misses        347      340       -7     

@hameerabbasi
Copy link
Collaborator Author

@mtsokol Do you primarily work on Windows? If so, would it be possible for you to look into why this fails only on Windows?

@mtsokol
Copy link
Collaborator

mtsokol commented Jan 8, 2024

@mtsokol Do you primarily work on Windows? If so, would it be possible for you to look into why this fails only on Windows?

I only have macos machine unfortunately.

@mtsokol
Copy link
Collaborator

mtsokol commented Jan 8, 2024

@hameerabbasi I have and idea what might be causing the failure. In test_elemwise.py (where tests are failing) there's a number of .astype(np.int_). np.int_ is an informal "default integer", which I think causes trouble here - on Windows it's 32bit but here for the sparse operation it stays as 64bit.

While working on NEP 52 there was even a discussion to remove np.int_ and np.uint to enforce users to use sized aliases explicitly (e.g. np.int64) or c-like names (np.long). np.int_ will get removed in a few releases: numpy/numpy#24743

Maybe a solution would be to replace .astype(np.int_) in test_elemwise.py with .astype(np.int64) or np.int32? (it's only bitwise and bitshift tests that are failing)

@mtsokol mtsokol self-requested a review January 8, 2024 10:39
@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 8, 2024

Maybe a solution would be to replace .astype(np.int_) in test_elemwise.py with .astype(np.int64) or np.int32? (it's only bitwise and bitshift tests that are failing)

That worked, thanks! I see you self-requested a review, I'll wait for that before merging.

Copy link
Collaborator

@mtsokol mtsokol left a comment

Choose a reason for hiding this comment

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

LGTM!

@hameerabbasi hameerabbasi merged commit c57510a into pydata:master Jan 8, 2024
13 checks passed
@hameerabbasi hameerabbasi deleted the moar-lints branch January 8, 2024 11:33
@hameerabbasi hameerabbasi mentioned this pull request Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants