feat: switch to use and out - #4359
flying-sheep wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4359 +/- ##
=========================================
+ Coverage 0 81.93% +81.93%
=========================================
Files 0 134 +134
Lines 0 12795 +12795
=========================================
+ Hits 0 10483 +10483
- Misses 0 2312 +2312
Flags with carried forward coverage won't be shown. Click here to find out more.
|
If we want to discourage use of
|
|
Yeah, I think |
|
Or sentinels, e.g. |
|
Yeah, an enum would of course be clearest, but I think the bool is intuitive enough, don’t you think? I currently left the default to be
|
I like that, this would establish some conventions |
|
Yeah! I’ll meet with Ilan today about this, and we’ll probably hash something out. I intentionally left it out of this PR so far since the design is still changing, so I don’t want to muddle the discussion with bikeshedding about which conventional names to settle on. |
|
Plan:
|
|
OK, multi-out is blocked on not having Storing accessors for e.g. |
Current design:
copyeverywhereuseandout– default foroutis to operate in place (out=False), whileout=Truemeans returning the matrix instead of writing it into AnnData.key_added/inplacefor the same functionality, likeNeighbors(dists=A.obsp["foo"], conns=A.obsp["bar"], meta=A.uns["foo"])(whereA.unsdoesn’t even exist yet)NamedTuples or so for the spots used. Probably what @ilan-gold would prefer, but we should meet to spec this out.Examples for
use/out(key_addedis unchanged):outmakes the singledispatch use some functions have (sc.pp.log1p(adata.X)) unnecessary, so we might deprecate that, what do you think?Example for how this improves code:
TODO:
useneeds to be consistently documenteduse_rawneeds deprecatingvar["mean"]/["std"]underout=True, should maybe gain areturn_statsparameter or soregress_outcopies a backed array before rejecting itanndata.accreplacement for functions takingobsm,layer, … #4334, closes Remove inplace/copy #2583