Skip to main content

fsspec

Access LucidLink filespaces from Python data libraries through fsspec.

Install with pip install "lucidlink[fsspec]". fsspec then opens lucidlink://workspace/filespace/path URLs with no import of lucidlink, and so do the libraries that open files through fsspec, such as pandas.

The service account token is the token option: pass token=... when you open a URL with fsspec, or storage_options={"token": ...} to pandas, which hands those options to fsspec. To keep the token out of the code, set the FSSPEC_LUCIDLINK_TOKEN environment variable instead.

PyArrow does not open lucidlink:// URLs: give it a LucidLinkFileSystem as filesystem, as in the example below.

Features

  • Read, write, list and search files with lucidlink:// URLs
  • Streaming reads: data is fetched as you read, so part of a large file is read without downloading all of it

  • Move and rename within a filespace without copying any data

  • Copy within a filespace and across filespaces

  • Several filespaces of one workspace through one instance

  • Sync to LucidLink on demand with sync_all(), or on LucidLinkFileSystem.close()

Usage with pandas

import pandas as pd
df = pd.read_csv(    "lucidlink://workspace/filespace/data.csv",    storage_options={"token": "sa_live:..."},)

Usage with PyArrow

import pyarrow.parquet as pqfrom lucidlink.fsspec import LucidLinkFileSystem
with LucidLinkFileSystem(token="sa_live:...") as fs:    table = pq.read_table(        "lucidlink://workspace/filespace/data.parquet", filesystem=fs    )

Direct usage

from lucidlink.fsspec import LucidLinkFileSystem
with LucidLinkFileSystem(token="sa_live:...") as fs:    with fs.open("lucidlink://workspace/filespace/file.txt", "r") as f:        content = f.read()