Skip to content

fix: scalar setting/reshape on CoW .X#2340

Merged
ilan-gold merged 9 commits into
0.12.xfrom
ig/backport_reshape_scalar
Feb 12, 2026
Merged

fix: scalar setting/reshape on CoW .X#2340
ilan-gold merged 9 commits into
0.12.xfrom
ig/backport_reshape_scalar

Conversation

@ilan-gold

Copy link
Copy Markdown
Contributor

@flying-sheep I'm ready to merge #2338 but noticed I hadn't backported this feature with the CoW branch. I'm actually not even 100% sure we should support these shortcuts. WDYT? I'll hold off on merging the other PR until I hear back.

  • Closes #
  • Tests added
  • Release note added (or unnecessary)

@codecov

codecov Bot commented Feb 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.89%. Comparing base (60226ed) to head (f3ada7d).
⚠️ Report is 22 commits behind head on 0.12.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           0.12.x    #2340      +/-   ##
==========================================
+ Coverage   84.82%   86.89%   +2.06%     
==========================================
  Files          46       46              
  Lines        7251     7259       +8     
==========================================
+ Hits         6151     6308     +157     
+ Misses       1100      951     -149     
Files with missing lines Coverage Δ
src/anndata/_core/anndata.py 83.80% <100.00%> (+0.16%) ⬆️

... and 7 files with indirect coverage changes

@flying-sheep

Copy link
Copy Markdown
Member

I'm actually not even 100% sure we should support these shortcuts

Hmm, maybe only if X is not None so we don’t have to guess the container data type?

Anyway, I don’t have a strong opinion here

@ilan-gold

ilan-gold commented Feb 12, 2026

Copy link
Copy Markdown
Contributor Author

Hmm, maybe only if X is not None so we don’t have to guess the container data type?

That's a good point. But then what if it's sparse? We do a dense-sparse matrix? I think I will add a warning that setting via scalars (and reshaping) will be deprecated at some point and for now it is np.full when scalar

@ilan-gold ilan-gold marked this pull request as ready for review February 12, 2026 11:53
Comment thread tests/test_views.py Outdated
Comment thread tests/test_views.py Outdated
@ilan-gold ilan-gold enabled auto-merge (squash) February 12, 2026 12:51
@ilan-gold ilan-gold merged commit c6c7d8d into 0.12.x Feb 12, 2026
20 of 21 checks passed
@ilan-gold ilan-gold deleted the ig/backport_reshape_scalar branch February 12, 2026 13:03
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.

2 participants