You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then path.read_text() returns the right file content, but no file is cached in /tmp/some/cache/folder/. Moreover, path.fs returns the vanilla gcsfs.core.GCSFileSystem, not the expected WholeFileCacheFileSystem.
Am I using the API wrong? How does one force a filesystem to be used with upath?
The text was updated successfully, but these errors were encountered:
alex-at-reliant
changed the title
UPath created with specific filesystem does not use that filesystem?
UPath created with specific filesystem does not use that filesystem
May 16, 2025
UPath.__init__ does not support a fs keyword argument, which means you can't provide an instantiated filesystem to UPath.
chained filesystems as you're trying to use with the filecache are currently not supported. Once wip: start implementing chain functionality #346 is completed and merged this functionality will be available and supported.
That being said, you could try the following right now, though it is untested and might not work:
# if this works I would not recommend to using it.# better wait for the next release when chained urlpath support is availablepth=UPath(
"bucket/some/path/to/some/file.json"protocol="filecache",
target_protocol="gs",
cache_storage="/tmp/some/cache/folder/",
)
Also, if you don't mind me asking: Was there some text in the documentation, that made you assume you can pass fs=filesystem_instance to UPath as a keyword argument?
Thanks a lot for the quick feedback. I don't remember how I came about this reference in the flurry of searches I did to see how I could cache stuff with fsspec and upath, unfortunately. And I remember not being able to confirm if filesystem or fs is a viable kwarg for upath.UPath by just looking at the code, due to the indirection around how kwargs are blindly passed around.
I am setting up
to do
Then
path.read_text()
returns the right file content, but no file is cached in/tmp/some/cache/folder/
. Moreover,path.fs
returns the vanillagcsfs.core.GCSFileSystem
, not the expectedWholeFileCacheFileSystem
.Am I using the API wrong? How does one force a filesystem to be used with upath?
The text was updated successfully, but these errors were encountered: