opendalfs is a fsspec filesystem
backed by Apache OpenDAL. It lets Python libraries
that work with fsspec use storage services supported by OpenDAL.
Documentation: opendalfs.readthedocs.io
opendalfs requires Python 3.12 or newer.
pip install opendalfsThe OpenDAL memory service provides a small example that needs no credentials and writes nothing to disk:
from opendalfs import OpendalFileSystem
fs = OpendalFileSystem("memory")
fs.pipe_file("hello.txt", b"hello from opendalfs\n")
assert fs.cat_file("hello.txt") == b"hello from opendalfs\n"OpendalFileSystem implements the fsspec filesystem interface, including
methods such as open, ls, glob, info, and rm. Use
OpendalFileSystem(service, **options) to connect directly to any OpenDAL
backend.
Installing opendalfs makes these URLs available to fsspec and libraries
that use it.
opendal+s3://my-bucket/path/to/file
opendal+gcs://my-bucket/path/to/file
opendal+azblob://my-container/path/to/file
opendal+oss://my-bucket/path/to/file
opendal+webdav:///path/to/file
opendal+cos://my-bucket/path/to/file
opendal+obs://my-bucket/path/to/file
opendal+tos://my-bucket/path/to/file
opendal+huggingface://datasets/owner/repo/path/to/file
The prefixed protocols coexist with s3fs, gcsfs, adlfs, ossfs, webdav4, tosfs, and huggingface_hub.
The bucket or container in each URL selects where the operation runs.
import fsspec
fs, path = fsspec.core.url_to_fs(
"opendal+s3://my-bucket/reports/summary.csv",
region="us-east-1",
)Use fs.open(path) to read the object once you have configured access.
To use OpenDAL for s3:// and s3a:// URLs in the current process, call
override_protocols("s3") at startup. Use a context manager to restore the
previous fsspec registrations when the block exits.
import fsspec
from opendalfs import S3FileSystem, override_protocols
with override_protocols("s3"):
fs, path = fsspec.core.url_to_fs("s3://my-bucket/reports/summary.csv")
assert isinstance(fs, S3FileSystem)Register another OpenDAL backend such as Backblaze B2 with register_service("b2")
before opening opendal+b2://my-bucket/path/to/file. For an application-specific
protocol, subclass ServiceFileSystem and decorate it with @register_service.
import fsspec
from opendalfs import ServiceFileSystem, register_service
assert register_service("oss").protocol == "opendal+oss"
@register_service
class AppMemoryFS(ServiceFileSystem):
service = "memory"
protocol = "app-memory"
fs = fsspec.filesystem("app-memory")
fs.pipe_file("hello.txt", b"hello\n")
assert fs.cat_file("hello.txt") == b"hello\n"The S3, GCS, and Azure adapters accept native OpenDAL settings and selected options from the corresponding fsspec libraries. See the configuration reference for the supported options.
- Read the contributing guide to set up a development environment and submit changes.
- Open an issue for bugs and feature requests.
- Use GitHub Discussions for questions and general discussion.
opendalfs is licensed under the
Apache License 2.0.