briefcase.integrations.lakefs
pip install briefcase-ai[lakefs]Wraps a lakeFS repository so file reads are captured with the commit SHA they
were read at. Construction requires an endpoint and credentials (arguments or
LAKEFS_ENDPOINT / LAKEFS_ACCESS_KEY / LAKEFS_PRIVATE_KEY) and raises
without them; pass mock=True for an offline stub whose metadata carries
"mock": True.
VersionedClient
from briefcase.integrations.lakefs import VersionedClient
class BriefcaseClientStub: config = { "lakefs_endpoint": "https://example.lakefscloud.io/api/v1", "lakefs_access_key": "key", "lakefs_secret_key": "secret", }
client = BriefcaseClientStub()
versioned_client = VersionedClient( repository="knowledge-base", branch="main", briefcase_client=client, mock=True,)
if versioned_client.object_exists("config/defaults.json"): data = versioned_client.read_object("config/defaults.json")
versioned_client.list_objects(prefix="config/")print(versioned_client.get_commit())VersionedClient(repository, branch, commit="latest", briefcase_client=None, mock=False, require_live=False, ...) .read_object(path, return_metadata=False) .upload_object(path, data, content_type="application/octet-stream") .list_objects(prefix="") .object_exists(path) .get_commit()versioned_context, versioned
from briefcase.integrations.lakefs import versioned_context, versioned
class BriefcaseClient: """Stand-in for a configured Briefcase client (mock mode without lakeFS)."""
config = { "lakefs_endpoint": "https://lakefs.example.com/api/v1", "lakefs_access_key": "access-key", "lakefs_secret_key": "secret-key", }
client = BriefcaseClient()
# Context managerwith versioned_context(client, "knowledge-base", "main") as lakefs: config = lakefs.read_object("config/defaults.json") commit = lakefs.get_commit()
# Decorator: injects the client as `versioned_client`@versioned(repository="knowledge-base", branch="main")def load_config(versioned_client=None) -> dict: raw = versioned_client.read_object("config/defaults.json") return {"commit": versioned_client.get_commit()}
load_config(briefcase_client=client)versioned_context(briefcase_client, repository, branch="main", commit="latest", **kwargs)versioned(repository, branch="main", commit="latest", client_param="versioned_client")Branches, staged commits, and lineage
The open package also exports BranchManager, ArtifactLineageClient, and
StagedArtifactClient plus their result, validation, diff, and merge types.
TypeScript applications can use the corresponding typed client from
@briefcase-ai/runtime/lakefs.