Repository navigation
feat: write support for keys that aren’t file names - #2662
flying-sheep wants to merge 7 commits into
Conversation
eb84892 to
6a98023
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/json-io #2662 +/- ##
================================================
+ Coverage 85.94% 86.25% +0.31%
================================================
Files 51 51
Lines 8390 8508 +118
================================================
+ Hits 7211 7339 +128
+ Misses 1179 1169 -10
|
6a98023 to
2d67fe1
Compare
ilan-gold
left a comment
There was a problem hiding this comment.
Discussion is a bit mangled now, but scverse/zarr-convention-dataframe#1 is quite a strong suggestion that seems simpler to implement. Maybe let's discuss there and then I will implement there (and you here) whatever mechanism we settle on (your implementation here of other data frame things does not have to match mine otherwise)
622fd5a to
20b6199
Compare
0428361 to
ed0ed9c
Compare
Documentation build overview
158 files changed ·
|
4aee430 to
4c77cfe
Compare
4c77cfe to
8fd7652
Compare
8fd7652 to
b0850ab
Compare
|
Otherwise these fail: @pytest.mark.parametrize(
"existing", ["x", "x/y"], ids=["unescaped-group", "escaped-group"]
)
@pytest.mark.parametrize("key", ["a/b", "100%"])
@pytest.mark.parametrize(
"use", [lambda k: A.obsm[k], lambda _: A.obsm], ids=["single-key", "mapping"]
)
def test_use_escapes_keys(
diskfmt_store: Path | MemoryStore,
diskfmt: Literal["h5ad", "zarr"],
existing: str,
key: str,
use: Callable[[str], object],
) -> None:
"""`use=` escapes keys like a full write with the same `compat` does.
`100%` into an already escaped group is the silent case:
written literally, it would be read back as an escape sequence.
"""
adata = ad.AnnData(np.zeros((2, 3)), obsm={existing: np.zeros((2, 2))})
getattr(adata, f"write_{diskfmt}")(diskfmt_store, compat="0.14")
adata.obsm[key] = np.ones((2, 2))
getattr(adata, f"write_{diskfmt}")(diskfmt_store, use=use(key), compat="0.14")
back = getattr(ad, f"read_{diskfmt}")(diskfmt_store)
assert set(back.obsm) == {existing, key}
np.testing.assert_array_equal(back.obsm[key], np.ones((2, 2))) |
cb4214d to
4a53beb
Compare
ilan-gold
left a comment
There was a problem hiding this comment.
anndata/src/anndata/_settings.py
Line 25 in c8bbe5a
Unrelated, going to suggest taking a page out of Davis' Bennet's book, and having Claude do an adversarial test of this. Can Claude come up with use-cases where this breaks?
23fdb6e to
a382197
Compare
|
OK, did the adversarial review, it found the following issues with this PR:
It also found these, which I’d say we ignore:
It also flagged these issues that aren’t ours:
|
ca81b32 to
69d991c
Compare
781b17f to
167e1f7
Compare
|
OK changed the architecture:
|
This and the two PRs below it are I need in 0.14 (for scanpy 2.0 preview), except for
.unsaccessors.See also zarr-developers/zarr-specs#128
/and\inobsmkeys,obscolumns,unskeys, … #2450