API Referenceο
LucidLink Python Library
Access LucidLink filespaces from Python: streaming file I/O, fsspec integration, and LucidLink Connect.
See the Quick Start for usage examples.
- class lucidlink.Client(*, storage: StorageConfig | None = None, config: ClientConfig | None = None)[source]ο
LucidLink SDK client.
Manages the connection to LucidLink for one service-account credential. Each
Clientinstance is fully independent; multiple clients can run side-by-side in the same process and operate on different workspaces concurrently.Lifecycle:
client = Client() client.login(credentials) workspace = client.get_workspace(workspace_id) # ... use workspace ... client.close()
Or as a context manager:
with Client() as client: client.login(credentials) workspace = client.get_workspace(workspace_id) # ... use workspace ...
Multi-client (concurrent multi-account):
client_a = Client(storage=StorageConfig(mode=StorageMode.SANDBOXED)) client_b = Client(storage=StorageConfig(mode=StorageMode.SANDBOXED)) client_a.login(creds_a) client_b.login(creds_b) # both fully independent, with separate storage
Note
When running multiple concurrent clients, give each one a distinct
Storageso their per-filespace state lives under separate roots.- close() None[source]ο
Tear down the client: unlink all filespaces and release resources.
Safe to call multiple times. After
close(), the client must not be reused β create a newClientfor further work.
- get_workspace(id: str) Workspace[source]ο
Return the workspace with the given id.
- Parameters:
id β The workspace id (from
list_workspaces()).- Returns:
The live
Workspacefor filespace operations.- Raises:
AuthenticationError β If the client is not logged in.
ValueError β If
iddoes not match any accessible workspace.
- property is_logged_in: boolο
Whether
login()has been called successfully and not yetclose()-d.
- list_workspaces() List[WorkspaceInfo][source]ο
List workspaces this clientβs credentials grant access to.
- Returns:
A list of
WorkspaceInfodescriptors, one per accessible workspace. Pass an id toget_workspace()to obtain an operableWorkspacehandle.- Raises:
AuthenticationError β If the client is not logged in.
- login(credentials: ServiceAccountCredentials) None[source]ο
Authenticate to LucidLink with a service account token.
The token determines which workspace this client operates on.
- Parameters:
credentials β Service account credentials.
- Raises:
AuthenticationError β If already logged in with different credentials, or if authentication fails.
ClientError β If the client cannot be started.
- class lucidlink.ClientConfig(fs_cache_size_mb: int | None = None)[source]ο
Typed configuration for
Client.All fields are optional;
Nonemeans βuse the built-in defaultβ.Example:
client = Client(config=ClientConfig( fs_cache_size_mb=2048, ))
- fs_cache_size_mb: int | None = Noneο
1024 MB.
- Type:
Per-filespace disk cache size in megabytes. Default
- client
- connect
ConnectManagerConnectManager.add_data_store()ConnectManager.are_data_stores_available()ConnectManager.count_external_files()ConnectManager.get_data_store()ConnectManager.link_file()ConnectManager.link_http_file()ConnectManager.list_data_stores()ConnectManager.list_external_files()ConnectManager.rekey_data_store()ConnectManager.remove_data_store()ConnectManager.unlink_file()ConnectManager.update_http_file_url()
- connect_models
DataStoreCredentialsDataStoreInfoDataStoreInfo.access_keyDataStoreInfo.bucket_nameDataStoreInfo.endpointDataStoreInfo.from_dict()DataStoreInfo.key_idDataStoreInfo.kindDataStoreInfo.nameDataStoreInfo.regionDataStoreInfo.rekey_stateDataStoreInfo.secret_keyDataStoreInfo.url_expiration_minutesDataStoreInfo.use_virtual_addressing
DataStoreKindDataStoreRekeyStateLinkedFilesResultS3CredentialsS3DataStoreConfig
- credentials
- exceptions
- filespace
- filesystem
FileHandleFilesystemFilesystem.create()Filesystem.create_dir()Filesystem.create_symlink()Filesystem.delete()Filesystem.delete_dir()Filesystem.dir_exists()Filesystem.file_exists()Filesystem.get_entry()Filesystem.get_size()Filesystem.get_statistics()Filesystem.list_dir()Filesystem.lock_byte_range()Filesystem.move()Filesystem.open()Filesystem.open_legacy()Filesystem.read_dir()Filesystem.read_file()Filesystem.read_symlink()Filesystem.truncate()Filesystem.unlock_all_byte_ranges()Filesystem.unlock_byte_range()Filesystem.write_file()
- fsspec
AbstractFileSystemLucidLinkFileSystemLucidLinkFileSystem.cat()LucidLinkFileSystem.cat_file()LucidLinkFileSystem.close()LucidLinkFileSystem.exists()LucidLinkFileSystem.get()LucidLinkFileSystem.info()LucidLinkFileSystem.isdir()LucidLinkFileSystem.isfile()LucidLinkFileSystem.ls()LucidLinkFileSystem.makedirs()LucidLinkFileSystem.mkdir()LucidLinkFileSystem.mv()LucidLinkFileSystem.optionsLucidLinkFileSystem.protocolLucidLinkFileSystem.put()LucidLinkFileSystem.rename()LucidLinkFileSystem.rm()LucidLinkFileSystem.rmdir()LucidLinkFileSystem.sync_all()
- filespace_models
- filesystem_models
- storage
- stream
LucidFileStreamLucidFileStream.close()LucidFileStream.closedLucidFileStream.fileno()LucidFileStream.isatty()LucidFileStream.modeLucidFileStream.nameLucidFileStream.read()LucidFileStream.readable()LucidFileStream.readinto()LucidFileStream.seek()LucidFileStream.seekable()LucidFileStream.tell()LucidFileStream.truncate()LucidFileStream.writable()LucidFileStream.write()
open_buffered()open_text()
- workspace
- workspace_models
Deprecatedο
The Daemon facade and the create_daemon() factory are kept for backward
compatibility; new code should use lucidlink.Client.
- lucidlink.create_daemon(config: Dict[str, str] | None = None, sandboxed: bool = True, persist_files: bool = False, root_path: str | Path | None = None) Daemon[source]ο
Create a
Daemonwith simplified storage configuration.Deprecated since version Use:
lucidlink.Clientinstead.This is a convenience factory that makes it easier to configure daemon storage without needing to manually create
StorageConfigobjects.- Parameters:
config β Additional daemon configuration options (cache size, etc.)
sandboxed β If
True(default), use temp directory thatβs always cleaned up. IfFalse, use.lucidsubfolder in current directory.persist_files β If
False(default), clean up files when daemon stops. Only applies whensandboxed=False. Sandboxed mode always cleans up.root_path β Override root path for files (only when
sandboxed=False). IfNone, uses current working directory.
- Returns:
Daemoninstance with specified storage configuration
Example
# Sandboxed (default) - files in temp, always cleaned up daemon = lucidlink.create_daemon() # Physical with cleanup - files in .lucid/, cleaned up on exit daemon = lucidlink.create_daemon(sandboxed=False) # Physical with persistence - files in .lucid/, kept after exit daemon = lucidlink.create_daemon(sandboxed=False, persist_files=True) # Custom root path daemon = lucidlink.create_daemon( sandboxed=False, root_path="D:/lucid_data", ) # With custom config daemon = lucidlink.create_daemon( config={"fs.cache.size": "2048"}, sandboxed=False, persist_files=True, )