Skip to content

Conversation

@quentinblampey
Copy link
Contributor

If torch is installed, importing spatialdata will also import torch because of ImageTilesDataset.

This PR aims to speed up the import by making the import of torch lazy.

It's a little bit tricky to keep all the dosctrings + auto-completion. For now, it seems the auto-completion is working fine for the instances, but not the __init__ docstrings.

If you think this PR seems interesting, I can work on fixing the docstrings, else we can just close it

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.15%. Comparing base (53b9438) to head (360fdc4).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1027      +/-   ##
==========================================
+ Coverage   92.11%   92.15%   +0.03%     
==========================================
  Files          49       49              
  Lines        7537     7542       +5     
==========================================
+ Hits         6943     6950       +7     
+ Misses        594      592       -2     
Files with missing lines Coverage Δ
src/spatialdata/dataloader/__init__.py 100.00% <100.00%> (+50.00%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zethson
Copy link
Member

Zethson commented Dec 12, 2025

Very much interesting and we did something similar for anndata: scverse/anndata#1959

Feel free to consider our approach that we used there.

@quentinblampey
Copy link
Contributor Author

Oh thanks @Zethson, your approach seems much better and very straightforward, I'll try that!

@quentinblampey
Copy link
Contributor Author

I made the change, WDYT @Zethson?

@Zethson
Copy link
Member

Zethson commented Dec 23, 2025

Looks fine but I'll leave this PR up to the maintainers now.

@LucaMarconato
Copy link
Member

LGTM thanks a lot!

@LucaMarconato LucaMarconato merged commit 901a0c3 into scverse:main Dec 23, 2025
18 of 19 checks passed
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.

3 participants