add backends - #4108
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4108 +/- ##
==========================================
+ Coverage 79.21% 79.32% +0.10%
==========================================
Files 128 130 +2
Lines 13446 13516 +70
==========================================
+ Hits 10651 10721 +70
Misses 2795 2795
Flags with carried forward coverage won't be shown. Click here to find out more.
|
# Conflicts: # pyproject.toml # src/scanpy/get/_aggregated.py # src/scanpy/preprocessing/_pca/__init__.py # src/scanpy/tools/_diffmap.py # src/scanpy/tools/_embedding_density.py # src/scanpy/tools/_rank_genes_groups.py
flying-sheep
left a comment
There was a problem hiding this comment.
looks good! I didn’t look at the test yet (I will once you mark it ready for review)
| def use_backend(self, backend: str): | ||
| """Temporarily set the active computational backend.""" | ||
| from .._backends import settings as backend_settings | ||
|
|
||
| return backend_settings.use_backend(backend) |
There was a problem hiding this comment.
this should be removed, sc.settings.override(backend=...) exists, and if it doesn’t work for some reason, we should fix that
| def get_backend(self, name: str): | ||
| """Look up an installed computational backend by name or alias.""" | ||
| from .._backends import settings as backend_settings | ||
|
|
||
| return backend_settings.get_backend(name) |
There was a problem hiding this comment.
Why does this exist? Does the user ever need to access the backend object?
| return FakeRapidsBackend | ||
|
|
||
|
|
||
| DISPATCHED_FUNCTIONS = [ |
There was a problem hiding this comment.
I don’t want to keep this in sync. Can’t the decorator just populate a list that we can access here?
One thing to note is that it probably can’t just put its function argument in the list, as other decorators might be applied after this one.
| "pynndescent>=0.5.13", | ||
| "scikit-learn>=1.6", | ||
| "scipy>=1.15", | ||
| "scverse-backends>=0.0.3,<0.1", |
There was a problem hiding this comment.
this has no dependencies right?
There was a problem hiding this comment.
No None. I'll also remove the pin
Co-authored-by: Philipp A. <flying-sheep@web.de>
Summary
sc.get.aggregate.scverse-backends>=0.0.3and exercise its lazy entry-point discovery and automatic backend-parameter signature injection.main, preserving upstream API changes alongside dispatch decorators.Validation
uv run --group test pytest -q tests/test_backends.py tests/test_package_structure.py::test_sig_conventionsuv run --group test pytest -q tests/test_aggregated.py tests/test_pca.py tests/test_embedding.py tests/test_rank_genes_groups.py