Skip to content

Load AnnLoader lazily to avoid torch imports when not requested #1959

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 7 commits into
base: main
Choose a base branch
from

Conversation

Zethson
Copy link
Member

@Zethson Zethson commented Apr 10, 2025

  • Closes Import torch lazily #1950
  • Tests added: No because we don't have have a matrix with torch. Happy to add something if desired.
  • Release note added (or unnecessary)

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

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

Project coverage is 85.03%. Comparing base (089ed92) to head (631aafa).

Files with missing lines Patch % Lines
src/anndata/experimental/__init__.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1959      +/-   ##
==========================================
- Coverage   87.13%   85.03%   -2.10%     
==========================================
  Files          47       47              
  Lines        6848     6850       +2     
==========================================
- Hits         5967     5825     -142     
- Misses        881     1025     +144     
Files with missing lines Coverage Δ
src/anndata/experimental/__init__.py 88.23% <33.33%> (-11.77%) ⬇️

... and 7 files with indirect coverage changes

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

@Zethson Zethson added this to the 0.12.0 milestone Apr 15, 2025
@Zethson Zethson marked this pull request as ready for review April 15, 2025 19:32
@Zethson Zethson requested a review from flying-sheep April 15, 2025 20:01
@Zethson Zethson changed the title Load torch lazily for AnnLoader Load AnnLoader lazily to avoid torch imports when not requested Apr 15, 2025
@@ -24,3 +24,4 @@
- Adopt the Scientific Python [deprecation schedule](https://scientific-python.org/specs/spec-0000/) {user}`ilan-gold` ({pr}`1768`)
- Allow {mod}`zarr` v3 writing of data {user}`ilan-gold` ({pr}`1892`)
- {func}`anndata.register_anndata_namespace` functionality for adding custom functionality to an {class}`~anndata.AnnData` object {user}`srivarra` ({pr}`1870`)
- Load AnnLoader lazily to prevent expensive unnecessary `torch` imports when its available on the system. {user}`Zethson` & {user}`flying-sheep` ({pr}`1959`)
Copy link
Member

Choose a reason for hiding this comment

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

this (without the -) belongs into a file called 1959.performance.md that you create using hatch towncrier:create

0.12.0rc1 is already released and its release notes are complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import torch lazily
2 participants