FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: write support for sequences and accessors by flying-sheep · Pull Request #2658 · scverse/anndata · GitHub

feat: write support for sequences and accessors - #2658

Open
flying-sheep wants to merge 1 commit into
feat/write-compat-profilesfrom
feat/json-io
Open

flying-sheep wants to merge 1 commit into
feat/write-compat-profilesfrom
feat/json-io

Conversation

flying-sheep commented Sep 22, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

TODO:

  • go over it and figure out if it’s robust, clean up slop, …
  • maybe split up into multiple PRs

  • Release note not necessary because:

flying-sheep added this pull request to stack #2659 September 22, 2026 15:45

codecov Bot commented Sep 22, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.78049% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.93%. Comparing base (8d37162) to head (4d96389).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/anndata/_io/specs/registry.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           feat/write-compat-profiles    #2658      +/-   ##
==============================================================
+ Coverage                       85.82%   85.93%   +0.11%     
==============================================================
  Files                              50       50              
  Lines                            8182     8243      +61     
==============================================================
+ Hits                             7022     7084      +62     
+ Misses                           1160     1159       -1     
Files with missing lines Coverage Δ
src/anndata/_core/anndata.py 86.39% <100.00%> (+0.17%) ⬆️
src/anndata/_io/specs/methods.py 92.05% <100.00%> (+0.39%) ⬆️
src/anndata/_write_compat.py 93.93% <100.00%> (+6.84%) ⬆️
src/anndata/types.py 91.66% <100.00%> (ø)
src/anndata/_io/specs/registry.py 94.91% <96.77%> (-0.02%) ⬇️

Comment thread src/anndata/_io/specs/methods.py Outdated
flying-sheep marked this pull request as ready for review September 24, 2026 15:35
flying-sheep added this to the 0.14.0 milestone Sep 24, 2026
flying-sheep mentioned this pull request Sep 25, 2026
2 of 3 tasks
flying-sheep force-pushed the feat/json-io branch 3 times, most recently from 7b46343 to 3027d25 Compare September 25, 2026 10:57
flying-sheep changed the title feat: write lists, any keys and accessors feat: write lists and accessors Sep 25, 2026
flying-sheep changed the title feat: write lists and accessors feat: write support for sequences and accessors Sep 25, 2026

ilan-gold left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

So I'm not sure I like this design...I'd like to ask in the zarr Zulip about this...

Comment thread docs/fileformat-prose.md
Comment on lines +345 to +359
Together with mappings,
this allows storing arbitrary JSON-like structures in `uns`,
with leaves of any encodable type.

Writing these requires the `"0.14"` {doc}`write compatibility profile <write-compat>`,
since older anndata versions cannot read them.

```python
>>> store["uns/hetero"].visititems(print) # uns["hetero"] == [1, "b", df]
0 <HDF5 dataset "0": shape (), type "<i8">
1 <HDF5 dataset "1": shape (), type "|O">
2 <HDF5 group "/uns/hetero/2" (2 members)>
2/_index <HDF5 dataset "_index": shape (2,), type "|O">
2/a <HDF5 dataset "a": shape (2,), type "<i8">
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My point in #1979 (and I think to some degree the author's) was that we would no longer store a bunch of stuff to disk anymore as arrays that can be more succinctly just be JSON. I think a key in uns called as-json or similar could make sense. Then we dump there whatever the "user wants" to be dumped there for JSON-like access.

ilan-gold commented Sep 29, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

It might be worth jamming zarr-developers/zarr-extensions#9 through in advance of this if there is appetite from the zarr maintainers (which there seems to be)

flying-sheep commented Oct 1, 2026 •
edited
Loading

Copy link
Copy Markdown
Member Author

Can you link to your zarr zulip post please? /edit: found it #Zarr-Python > json in zarr

I think I’d be totally OK with not having heterogeneous sequences but instead a JSON type. The only question is how to decide when to use it. adata.uns["foo"]["ad"] = AnnData(...) stays serializable, so when looking at the .uns["foo"] dict, how do we decide if we store it as JSON or not? And of course that doesn’t mean we don’t need #2662.

Regarding zarr-developers/zarr-extensions#9: I’m not looking forward to adding more blockers to the stack. I planned to finish up this PR stack during the conference, then scanpy 1.13 right after. If they can commit to this next week I’d say that’s fine, but I don’t want to wait in case that issue is asleep for a few more months.

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Allow storing heterogeneous lists in .uns (as JSON or so)

2 participants


Back | FazBrowse Home | New Git URL