Init hosted instance#

!lamin login testuser1
import lamindb_setup as ln_setup
from lamindb_setup.core.upath import UPath
from lamindb_setup.core._hub_core import delete_instance_by_slug
import pytest

instance_name = "my-hosted"
assert ln_setup.settings.user.handle == "testuser1"
delete_instance_by_slug(f"testuser1/{instance_name}")
with pytest.raises(ValueError):
    ln_setup.init(storage="create-s3")
ln_setup.init(name="my-hosted", storage="create-s3")
from lamindb_setup.core.upath import hosted_buckets
assert ln_setup.settings.instance.storage.is_cloud == True
assert ln_setup.settings.instance.owner == ln_setup.settings.user.handle
assert ln_setup.settings.instance.name == "my-hosted"
assert ln_setup.settings.storage.root.as_posix().startswith(hosted_buckets)
assert ln_setup.settings.storage.id is not None
ln_setup.close()