lamindb.setup.core
¶
Setup core library.
Settings¶
- class lamindb.setup.core.SetupSettings¶
Setup settings.
- property settings_dir: Path¶
The directory that holds locally persisted settings.
- property auto_connect: bool¶
Auto-connect to current instance upon
import lamindb.This setting is always
Trueand will be removed in a future version.
- property dev_dir: Path | None¶
Get or set the local development directory for the current instance.
If setting it to
None, the working development directory is unset.
- property is_connected: bool¶
Determine whether the current instance is fully connected and ready to use.
If
True, the current instance is connected, meaning that the db and other settings are properly configured for use.
- property private_django_api: bool¶
Turn internal Django API private to clean up the API (default
False).This patches your local pip-installed django installation. You can undo the patch by setting this back to
False.
- property user: UserSettings¶
Settings of current user.
- property instance: InstanceSettings¶
Settings of current LaminDB instance.
- property storage: StorageSettings¶
Settings of default storage.
- property paths: type[SetupPaths]¶
Convert cloud paths to lamindb local paths.
Use
settings.paths.cloud_to_local_no_updateorsettings.paths.cloud_to_local.
- class lamindb.setup.core.UserSettings(handle='anonymous', email=None, api_key=None, password=None, access_token=None, uid='null', _uuid=None, name=None)¶
User data. All synched from cloud.
-
handle:
str= 'anonymous'¶ Unique handle.
-
email:
str|None= None¶ User email.
-
api_key:
str|None= None¶ API key.
-
password:
str|None= None¶ Legacy password.
-
access_token:
str|None= None¶ User access token.
-
uid:
str= 'null'¶ Universal user ID.
-
name:
str|None= None¶ Full name.
- property id¶
Integer id valid in current instance.
-
handle:
- class lamindb.setup.core.InstanceSettings(id, owner, name, storage=None, keep_artifacts_local=False, db=None, modules=None, git_repo=None, is_on_hub=None, api_url=None, schema_id=None, fine_grained_access=False, db_permissions=None, _locker_user=None, _is_clone=False)¶
Instance settings.
- property owner: str¶
Instance owner. A user or organization account handle.
- property name: str¶
Instance name.
- property keep_artifacts_local: bool¶
Default to keeping artifacts local.
- property storage: StorageSettings¶
Default storage of instance.
For a cloud instance, this is cloud storage. For a local instance, this is a local directory.
- property local_storage: StorageSettings¶
An alternative default local storage location in the current environment.
Serves as the default storage location if
keep_artifacts_localis enabled.
- property slug: str¶
Unique semantic identifier of form
"{account_handle}/{instance_name}".
- property git_repo: str | None¶
Sync transforms with scripts in git repository.
Provide the full git repo URL.
- property api_url: str | None¶
URL for REST API.
Use this URL for API calls related to this instance.
- property ui_url: str | None¶
URL for UI.
Use this URL for accessing the UI related to this instance.
- property is_read_only_connection: bool¶
Whether the current connection to the database is read-only.
- property available_spaces: dict | None¶
Available spaces with roles for instances fine-grained permissions.
Returns a dictionary with roles as keys and lists of available spaces as values if this instance has fine-grained permissions and the current user is a collaborator,
Noneotherwise.
- property uid: str¶
The user-facing instance id.
- property modules: set[str]¶
The set of modules that defines the database schema.
The core schema contained in lamindb is not included in this set.
- property db: str¶
Database connection string (URI).
- property dialect: Literal['sqlite', 'postgresql']¶
SQL dialect.
Equivalent to
vendor.“vendor” is the Django terminology for the type of database. “dialect” is the SQLAlchemy terminology.
- property vendor: Literal['sqlite', 'postgresql']¶
Database vendor.
Equivalent to
dialect.“vendor” is the Django terminology for the type of database. “dialect” is the SQLAlchemy terminology.
- property is_remote: bool¶
Boolean indicating if an instance has no local component.
- property is_on_hub: bool¶
Is this instance registered on the hub?
Can only establish if user has access to the instance. Will return
Falsein case the user token can’t find the instance.
- property is_managed_by_hub: bool¶
Is this instance managed by the hub?
Returns
Trueif the instance is _managed_ by LaminHub, i.e., it was connected to LaminHub to manage access, migrations, a REST API, a UI, etc.
- class lamindb.setup.core.StorageSettings(root, region=None, uid=None, uuid=None, instance_id=None, access_token=None)¶
Settings for a storage location (local or cloud).
Do not instantiate this class yourself, use
ln.Storageinstead.- property uid: str¶
Storage uid.
- property instance_uid: str | None¶
The
uidof the managing LaminDB instance.If
None, the storage location is not managed by any LaminDB instance.
- property record: Any¶
Storage record in the current instance.
- property root_as_str: str¶
Formatted root string.
- property type_is_cloud: bool¶
Trueifstorage_rootis in cloud,Falseotherwise.
- property host: str | None¶
Host identifier for local storage locations.
Is
Nonefor locations withtype != "local".A globally unique user-defined host identifier (cluster, server, laptop, etc.).
- property region: str | None¶
Storage region.
- property type: Literal['local', 's3', 'gs', 'hf', 'http', 'https']¶
AWS S3 vs. Google Cloud vs. local.
Returns the protocol as a stringe, e.g., “local”, “s3”, “gs”, “http”, “https”.
- property is_on_hub: bool¶
Is this instance on the hub.
Only works if user has access to the instance.
- cloud_to_local(filepath, cache_key=None, **kwargs)¶
Local (or local cache) filepath from filepath.
- Return type: