Skip to content

getters for SpatialData format (version) - #288

Merged
Artur-man merged 11 commits into
HelenaLC:develfrom
Artur-man:version
Oct 29, 2026
Merged

Artur-man merged 11 commits into
HelenaLC:develfrom
Artur-man:version

Conversation

@Artur-man

@Artur-man Artur-man commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #115.

  • claude review
  • implement tests
  • lint and air
  • update NEWS

@Artur-man
Artur-man marked this pull request as draft October 23, 2026 19:11
Comment thread R/sdAttrs.R Outdated

#' @export
#' @rdname format
setMethod("format", "SpatialDataAttrs", \(x) x$spatialdata_attrs$version)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

why is the function called "format" and not "version"? I find "format" confusing, no? Isn't the "format" "as spatialdata .Zarr store"?

@Artur-man Artur-man Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

great question, I am also confused about this ... zarr has formats, but not versions (even though @Bisaloo calls them versions).
https://zarr.readthedocs.io/en/stable/api/zarr/functions/create/#zarr.create
https://huber-group-embl.github.io/Rarr/reference/write_zarr_array.html

@LucaMarconato also uses format and version interchangeably.
https://github.com/scverse/spatialdata/blob/main/src/spatialdata/_io/format.py

I am neutral, I can also call it version, but lets talk about it first.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is my understanding that Zarr, OME-Zarr and SD use formats, and those formats have versions.

Check the arguments in SpatialData.write. It is referred to as a format, not version:
https://spatialdata.scverse.org/en/stable/api/SpatialData.html#spatialdata.SpatialData.write

@Artur-man Artur-man Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I thought about this a little bit and decided to go with version. I think the use of word format is quite inaccurate in both anndata and zarr-python.
https://anndata.readthedocs.io/en/stable/generated/anndata.settings.html#anndata.settings.zarr_write_format

That the 2 or 3 are versions of the format but not formats themselves, even though zarr_format replaced zarr_version to avoid confusion with the library version.
https://zarr.readthedocs.io/en/latest/user-guide/v3_migration/#miscellaneous

Thus version(sd) or version(image(sd)) are more intuitive as in "version of format of image data"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see format as a shorthand for "version of the format". I have no strong opinions on the naming here.

@LucaMarconato LucaMarconato Oct 24, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

But, useful thing, with the help of @jan-glx we simplified the versioning of SpatialData stores by introducing a global "Storage Format" versioning, which is bumped whenever any of the version of the elements or SpatialData container is bumped. On top of this we have now a table that clarify the relationship with also the Zarr format versions, OME-Zarr format versions, software versions, etc. We have a draft in spatialdata-spec (@Artur-man saw already). The code does not write or read this version string yet, but we'll get there.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'll let you know when we are done with the draft and the improved versioning system can be translated into code.

@Artur-man Artur-man Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ah thanks, I will try to go with version for now, but I am consulting with Herve Pages before pushing since there are functions/variables named version. If he has strong opinions against, we can go with format.

The function is mostly used for internal purposes anyway. I do not expect people to follow this complex versioning schema.

@github-actions

Copy link
Copy Markdown

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 360c6dc is merged into devel:

  • ✔️crop: 11.1s -> 11.4s [-2.22%, +6.5%]
  • ✔️pkg_load: 9.82s -> 9.8s [-6.43%, +6.13%]
  • ✔️read_full: 8.85s -> 9.08s [-3.5%, +8.72%]
  • ✔️show: 4.08s -> 4.09s [-11.56%, +11.94%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@Artur-man
Artur-man marked this pull request as ready for review October 24, 2026 19:57
@Artur-man

Copy link
Copy Markdown
Collaborator Author

I have realised that BiocManager::version() exists. Is this overlap bad or not ? That being said, most BiocManager functions are used as BiocManager::<name of function>.

@github-actions

Copy link
Copy Markdown

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 5699a41 is merged into devel:

  • ✔️crop: 5.59s -> 5.6s [-0.78%, +1.05%]
  • ✔️pkg_load: 5.53s -> 5.55s [-0.89%, +1.53%]
  • ✔️read_full: 5.99s -> 6.07s [-1.11%, +3.62%]
  • ✔️show: 4.31s -> 4.32s [-1.21%, +1.73%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@Artur-man

Copy link
Copy Markdown
Collaborator Author

I will merge this for now but we can change the name of function any time.

@Artur-man
Artur-man merged commit 224a4c6 into HelenaLC:devel Oct 29, 2026
16 of 18 checks passed
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.

3 participants