[python] Implement read
, seek
, and tell
for SOMAVFSFilebuf
#3543
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.
Issue and/or context:
[sc-61381]
Although
h5py
does support ingesting S3 files directly, as already noted in our documentation,anndata
uses the default driver which means it expects local files withos.PathLike URIs
. This is what motivates us to implement the_FSPathWrapper
so thatanndata
can pass the file toh5ad
and parse it as a file-like object. However, in order to actually be a file-like object, we need to implement the read and seek methods. Otherwise, whenmake_fid
attempts to open the file, it errors out withFileNotFoundError
because the object does not exist as a file-like object even though an object does exist at the given URI.This regression was introduced during the C++-ification work when
tiledb.VFS()
(which fully implements all file I/O methods required byh5py
) and replaced withclib.SOMAVFS
andclib.SOMAVFSFilebuf
.Changes:
Implement
read
,seek
, andtell
forSOMAVFSFilebuf
.Notes for Reviewer:
Proof that the original bug is fixed for 1.15:
No new tests were added because this only affects files on S3. However, this bug is further motivation to introduce testing with cloud storage.