Skip to content

Numba warning fix #1002

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

selmanozleyen
Copy link
Member

@selmanozleyen selmanozleyen commented May 21, 2025

Fixes: #994

Without the fix this is the warning I get in a notebook:

[/Users/selman.ozleyen/mambaforge/envs/squidpy/lib/python3.11/site-packages/numba/parfors/parfor.py:2395](https://file+.vscode-resource.vscode-cdn.net/Users/selman.ozleyen/mambaforge/envs/squidpy/lib/python3.11/site-packages/numba/parfors/parfor.py:2395): NumbaPerformanceWarning: 
prange or pndindex loop will not be executed in parallel due to there being more than one entry to or exit from the loop (e.g., an assertion).

File "/Users/selman.ozleyen/projects/squidpy/docs/notebooks/tutorials", line 31:
<source missing, REPL/exec in use?>

I don't think it is possible to add a test case because in theory that part of the code is unreachable

@codecov-commenter
Copy link

codecov-commenter commented May 21, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 66.63%. Comparing base (4a632d6) to head (daf87bb).
Report is 197 commits behind head on main.

Files with missing lines Patch % Lines
src/squidpy/gr/_ligrec.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1002      +/-   ##
==========================================
- Coverage   69.99%   66.63%   -3.36%     
==========================================
  Files          39       40       +1     
  Lines        5532     6060     +528     
  Branches     1037     1015      -22     
==========================================
+ Hits         3872     4038     +166     
- Misses       1367     1662     +295     
- Partials      293      360      +67     
Files with missing lines Coverage Δ
src/squidpy/gr/_ligrec.py 77.36% <50.00%> (-0.80%) ⬇️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@selmanozleyen selmanozleyen requested a review from ilan-gold May 21, 2025 09:43
@ilan-gold
Copy link
Contributor

To catch this sort of thing, the project should use the filterwarnings option and tests run so that warnings are treated as errors as is done in scanpy/anndata.

@ilan-gold
Copy link
Contributor

ilan-gold commented May 21, 2025

So in this PR, you could also add to the pyproject.toml

[tool.pytest.ini_options]
filterwarnings = [ "error:NumbaPerformanceWarning" ]

or do it locally and go one-by-one and catch any others that exist

@ilan-gold
Copy link
Contributor

I think it might need to be a double colon: https://docs.pytest.org/en/stable/how-to/capture-warnings.html#controlling-warnings sorry for the mistype

@ilan-gold ilan-gold enabled auto-merge May 28, 2025 09:31
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.

Numba Early Exit Parallelization Bug/Warning
3 participants