lamindb.setup.core
¶
Setup core library.
Settings¶
- class lamindb.setup.core.SetupSettings¶
Setup settings.
- modules_warning: str | None = None¶
- property modules: set[str]¶
The set of configured schema modules for this environment.
Instance modules take precedence if an instance is configured, including when it is resolved from a dev-dir marker or
LAMIN_CURRENT_INSTANCE. Otherwise,LAMINDB_MODULESoverrides a global setting.
- 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¶
Development directory containing the working directory.
This is the nearest parent, including the working directory, with a
.lamin/current_instancemarker for the current instance.$HOMEis never a development directory. Outside every such directory the value isNone.Setting a path writes that marker and leaves every other development directory in place. Setting
Noneremoves the marker of the directory that contains the working directory.
- property branch: lamindb.Branch¶
Default branch.
- property space: lamindb.Space¶
Default space.
- 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 is_configured: bool¶
Whether an instance is configured in this environment.
Truemeans the current instance is a real instance (notnone/none).
- 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?
Most likely you’re looking for
is_managed_by_hub. The instance being registered on LaminHub doesn’t imply that LaminHub has access to the instance. If you want to know whether there is a LaminHub UI, useis_managed_by_hub. If you merely want to know whether the instance is registered, independent of whether LaminHub has access to the instance, useis_on_hub.The
is_on_hubproperty makes a network request to the hub and can only establish if an instance is registered if the calling user has access to the instance. Will returnFalsein case the user has no access.
- property is_managed_by_hub: bool¶
Is this instance managed by the hub?
Returns
Trueif the instance is managed by LaminHub, i.e., the instance was connected to LaminHub to manage permissions and migrations and provide access to the instance through a UI and a REST API.
- 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 hub_record: dict | None¶
- 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: