Skip to content

Numba warning fix - #1002

Merged
ilan-gold merged 6 commits into
scverse:mainfrom
selmanozleyen:fix/numba-warning
Jun 10, 2025
Merged

ilan-gold merged 6 commits into
scverse:mainfrom
selmanozleyen:fix/numba-warning

Conversation

@selmanozleyen

@selmanozleyen selmanozleyen commented May 21, 2025 •

Copy link
Copy Markdown
Member

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

codecov-commenter commented May 21, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.63%. Comparing base (5d48e4a) to head (d8b8f91).
⚠️ Report is 15 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   66.65%   66.63%   -0.02%     
==========================================
  Files          40       40              
  Lines        6057     6060       +3     
  Branches     1014     1015       +1     
==========================================
+ Hits         4037     4038       +1     
- Misses       1661     1662       +1     
- Partials      359      360       +1     
Files with missing lines Coverage Δ
src/squidpy/gr/_ligrec.py 77.36% <50.00%> (-0.46%) ⬇️
🚀 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
Copy Markdown
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

ilan-gold commented May 21, 2025 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@ilan-gold
ilan-gold merged commit 8b74755 into scverse:main Jun 10, 2025
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