[WIP] Fix relative references when store not in cwd #256
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Fix #255. Slight rework of how references are handled.
Currently, the "source" of links and references are relative to the directory that contains the currently open Zarr store.
Internal Zarr links and references use the name of the Zarr store as the "source". For example, if
file1.zarr
contains an internal link, that link looks like:External links: If
file0.zarr
andfile1.zarr
are in the same directory, andfile1.zarr
has an external link to a group infile0.zarr
, that link looks like:When reading
file1.zarr
from elsewhere, e.g.,ZarrIO("a/b/c/file1.zarr", mode="r")
, we need to make sure that the relative paths are resolved correctly froma/b/c
. Approach 1: Fix this.An alternative approach, which I believe was the original implementation, is that instead of writing paths relative to the directory that contain the currently open Zarr store, write paths relative to the currently open Zarr store. So internal links and references would have the
source: "."
and the above external link example would have thesource: "../file0.zarr"
. Approach 2: Return to this pre-0.10.0 way of storing "source" in links and references.I propose we take approach 2, because otherwise links in files written under the original implementation would not be readable - I tested this and indeed files with links written in 0.8.0 cannot be read in 0.10.0 - and approach 2 does not suffer any disadvantages in my eyes.
@mavaylon1 Let me know what you think.
TODO
Checklist
CHANGELOG.md
with your changes?