Skip to content

UPath kwargs are not persisted from layout root to BIDSFiles #1098

@effigies

Description

@effigies

The sqlalchemy serialize/deserialize loop makes it nontrivial to keep track of keyword arguments. For example:

from upath import UPath
from bids.layout import BIDSLayout

ds_root = UPath("s3://openneuro.org/ds000102", anon=True)
layout = BIDSLayout(ds_root)

description = layout.get(suffix='description', extension='.json')[0]
assert description._path.storage_options == ds_root.storage_options  # boom

Consequently, anonymous access to S3 datasets is not currently possible, and presumably there are other impacts on other protocols. This should be fixed.

Some previous notes from #1094:

If universal_pathlib provides an API to access these additional parameters, we could consider adding a column to the BIDSFile model and use it while reconstructing. Another approach could be to mutate BIDSFiles after creation, provided the access happens through a BIDSLayout method call that has access to ._root. Alternately, if we could somehow put this information in the SQLAlchemy session, then the BIDSFile.path property could access it on demand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions