Usage

You will first need to define your configuration object and then you can use RemoteMount with a context manager i.e. with or simply by calling .mount() and .unmount(). See below and

Open In Colab

AWS S3 Config Instructions

from rmount import S3
config = S3(
    provider="AWS",
    region="us-east-1",
    secret_access_key="xxx",
    access_key_id="xxx",
)

GCS S3 Config Instructions

config = S3(
    provider="GCS",
    secret_access_key="xxx",
    access_key_id="xxx",
    endpoint="https://storage.googleapis.com",
)

SSH Remote Config Instructions

from pathlib import Path
from rmount import Remote
config = Remote(
    host="localhost",
    user="root",
    port=22,
    key_file=Path.home() / ".ssh" / "id_rsa",
)

Example

# local directory
local_path = Path("/tmp/s3")
# remote directory e.g. s3://rmount gs://rmount or /rmount
remote_path = "rmount"
mount = RemoteMount(config, remote_path, local_path)
with mount:
    local_path.joinpath("foo").write_text("bar")