Skip to content

feat: add bbknn - #4306

Merged
flying-sheep merged 8 commits into
mainfrom
feat/add-bbknn
Aug 28, 2026
Merged

feat: add bbknn#4306
flying-sheep merged 8 commits into
mainfrom
feat/add-bbknn

Conversation

@Intron7

@Intron7 Intron7 commented Aug 19, 2026

Copy link
Copy Markdown
Member

This PR add a scanpy native bbknn implementation because of the removal of external

fixes #4302

@Intron7 Intron7 added this to the 1.13.0 milestone Aug 19, 2026
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.32%. Comparing base (84b6b1b) to head (ad9cfe6).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/scanpy/neighbors/_common.py 61.90% 8 Missing ⚠️
src/scanpy/neighbors/_bbknn.py 98.93% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4306      +/-   ##
==========================================
+ Coverage   80.14%   80.32%   +0.17%     
==========================================
  Files         133      134       +1     
  Lines       13478    13591     +113     
==========================================
+ Hits        10802    10917     +115     
+ Misses       2676     2674       -2     
Flag Coverage Δ
hatch-test.low-vers 77.48% <26.01%> (-0.45%) ⬇️
hatch-test.pre 80.20% <92.68%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/_utils/__init__.py 75.79% <ø> (ø)
src/scanpy/external/pp/_bbknn.py 100.00% <100.00%> (+54.54%) ⬆️
src/scanpy/neighbors/__init__.py 81.54% <ø> (ø)
src/scanpy/neighbors/_types.py 100.00% <100.00%> (ø)
src/scanpy/preprocessing/__init__.py 100.00% <100.00%> (ø)
src/scanpy/neighbors/_bbknn.py 98.93% <98.93%> (ø)
src/scanpy/neighbors/_common.py 72.54% <61.90%> (+0.94%) ⬆️

... and 1 file with indirect coverage changes

@flying-sheep flying-sheep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great!

I deduplicated the transformer creation method and adapted the heuristic a bit, and added a benchmark suite to check it. Take a look if that makes sense or if I missed something!

The only piece I think is missing is that we should get rid of legacy cruft, but I can take care of that:

  • no reason for _accepts_legacy_random_state
  • things like batch_key and so on should become something accepting AdRefs or strs in the resolve format ("obs.obs_colname" instead of "obs_colname", and then _key of course makes no sense).
  • including use_rep: #4315

@flying-sheep
flying-sheep force-pushed the feat/add-bbknn branch 2 times, most recently from 5b632ce to 6b6d769 Compare August 21, 2026 12:24
@flying-sheep
flying-sheep changed the base branch from main to neighbors-rng August 21, 2026 12:25
Base automatically changed from neighbors-rng to main August 21, 2026 13:37
Intron7 and others added 4 commits August 27, 2026 14:17
Signed-off-by: Intron7 <sdicks@nvidia.com>
Signed-off-by: Intron7 <sdicks@nvidia.com>
@flying-sheep

Copy link
Copy Markdown
Member

OK, merging #4315 before this one, then all of sc.external is deprecated!

@flying-sheep
flying-sheep merged commit 4644af8 into main Aug 28, 2026
4 of 6 checks passed
@flying-sheep
flying-sheep deleted the feat/add-bbknn branch August 28, 2026 08:21
flying-sheep added a commit that referenced this pull request Aug 28, 2026
Co-authored-by: Phil Schaf <flying-sheep@web.de>
Signed-off-by: Intron7 <sdicks@nvidia.com>
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.

Adopt scanpy.pp.bbknn

2 participants