diff --git a/docs/hub-cloud/01-init-local-instance.ipynb b/docs/hub-cloud/01-init-local-instance.ipynb index 7d995b60..d06e4ccc 100644 --- a/docs/hub-cloud/01-init-local-instance.ipynb +++ b/docs/hub-cloud/01-init-local-instance.ipynb @@ -48,7 +48,7 @@ "outputs": [], "source": [ "from pathlib import Path\n", - "from lnschema_core.models import Storage\n", + "from lamindb.models import Storage\n", "\n", "assert ln_setup.settings.instance.storage.type_is_cloud == False\n", "assert ln_setup.settings.instance.owner == ln_setup.settings.user.handle\n", diff --git a/docs/hub-cloud/03-add-managed-storage.ipynb b/docs/hub-cloud/03-add-managed-storage.ipynb index 863895ba..4d10929e 100644 --- a/docs/hub-cloud/03-add-managed-storage.ipynb +++ b/docs/hub-cloud/03-add-managed-storage.ipynb @@ -326,7 +326,7 @@ "from laminhub_rest.core.instance.collaborator import InstanceCollaboratorHandler\n", "from laminhub_rest.core.account.user import UserAccountHandler\n", "from lamindb_setup.core._hub_client import connect_hub_with_auth\n", - "from lnschema_core.models import User\n", + "from lamindb.models import User\n", "\n", "admin_hub = connect_hub_with_auth()\n", "testuser2 = UserAccountHandler(admin_hub).get_by_handle(\"testuser2\")\n", diff --git a/docs/hub-cloud/08-test-multi-session.ipynb b/docs/hub-cloud/08-test-multi-session.ipynb index 9801bdc7..bf98c7b7 100644 --- a/docs/hub-cloud/08-test-multi-session.ipynb +++ b/docs/hub-cloud/08-test-multi-session.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [], "source": [ - "from lnschema_core.models import User" + "from lamindb.models import User" ] }, { diff --git a/docs/hub-prod/test-connect-anonymously.ipynb b/docs/hub-prod/test-connect-anonymously.ipynb index aa7e34a7..716f42a7 100644 --- a/docs/hub-prod/test-connect-anonymously.ipynb +++ b/docs/hub-prod/test-connect-anonymously.ipynb @@ -31,7 +31,7 @@ "metadata": {}, "outputs": [], "source": [ - "ln_setup.connect(\"laminlabs/lamindata\")" + "ln_setup.connect(\"laminlabs/lamin-site-assets\")" ] }, { diff --git a/lamindb_setup/_check_setup.py b/lamindb_setup/_check_setup.py index 9f89946e..72f653e6 100644 --- a/lamindb_setup/_check_setup.py +++ b/lamindb_setup/_check_setup.py @@ -27,6 +27,7 @@ class InstanceNotSetupError(DefaultMessageException): CURRENT_ISETTINGS: InstanceSettings | None = None +IS_LOADING: bool = False def _get_current_instance_settings() -> InstanceSettings | None: @@ -54,16 +55,11 @@ def _get_current_instance_settings() -> InstanceSettings | None: # we make this a private function because in all the places it's used, # users should not see it -def _check_instance_setup( - from_lamindb: bool = False, from_module: str | None = None -) -> bool: - reload_module = from_lamindb or from_module is not None - from ._init_instance import get_schema_module_name, reload_schema_modules - +def _check_instance_setup(from_module: str | None = None) -> bool: if django.IS_SETUP: # reload logic here because module might not yet have been imported # upon first setup - if from_module is not None: + if from_module is not None and from_module != "lamindb": il.reload(il.import_module(from_module)) return True silence_loggers() @@ -75,18 +71,21 @@ def _check_instance_setup( return True isettings = _get_current_instance_settings() if isettings is not None: - if reload_module and settings.auto_connect: - if not django.IS_SETUP: + if ( + from_module is not None + and settings.auto_connect + and not django.IS_SETUP + and not IS_LOADING + ): + if not from_module == "lamindb": + import lamindb + + il.reload(il.import_module(from_module)) + else: django.setup_django(isettings) - if from_module is not None: - # this only reloads `from_module` - il.reload(il.import_module(from_module)) - else: - # this bulk reloads all schema modules - reload_schema_modules(isettings) logger.important(f"connected lamindb: {isettings.slug}") return django.IS_SETUP else: - if reload_module and settings.auto_connect: + if from_module is not None and settings.auto_connect: logger.warning(InstanceNotSetupError.default_message) return False diff --git a/lamindb_setup/_connect_instance.py b/lamindb_setup/_connect_instance.py index a414d4c3..4eb72f15 100644 --- a/lamindb_setup/_connect_instance.py +++ b/lamindb_setup/_connect_instance.py @@ -1,7 +1,7 @@ from __future__ import annotations +import importlib import os -import sys from typing import TYPE_CHECKING from uuid import UUID @@ -257,6 +257,14 @@ def connect(slug: str, **kwargs) -> str | tuple | None: if _test: return None silence_loggers() + # migrate away from lnschema-core + no_lnschema_core_file = ( + settings_dir / f"no_lnschema_core-{isettings.slug.replace('/', '--')}" + ) + if not no_lnschema_core_file.exists(): + migrate_lnschema_core( + isettings, no_lnschema_core_file, write_file=_write_settings + ) check, msg = isettings._load_db() if not check: local_db = ( @@ -292,21 +300,13 @@ def connect(slug: str, **kwargs) -> str | tuple | None: # except ProgrammingError: # pass load_from_isettings(isettings, user=_user, write_settings=_write_settings) + importlib.reload(importlib.import_module("lamindb")) except Exception as e: if isettings is not None: if _write_settings: isettings._get_settings_file().unlink(missing_ok=True) # type: ignore settings._instance_settings = None raise e - # rename lnschema_bionty to bionty for sql tables - if "bionty" in isettings.schema: - no_lnschema_bionty_file = ( - settings_dir / f"no_lnschema_bionty-{isettings.slug.replace('/', '')}" - ) - if not no_lnschema_bionty_file.exists(): - migrate_lnschema_bionty( - isettings, no_lnschema_bionty_file, write_file=_write_settings - ) return None @@ -322,13 +322,10 @@ def load(slug: str) -> str | tuple | None: return result -def migrate_lnschema_bionty( - isettings: InstanceSettings, no_lnschema_bionty_file: Path, write_file: bool = True +def migrate_lnschema_core( + isettings: InstanceSettings, no_lnschema_core_file: Path, write_file: bool = True ): - """Migrate lnschema_bionty tables to bionty tables if bionty_source doesn't exist. - - :param db_uri: str, database URI (e.g., 'sqlite:///path/to/db.sqlite' or 'postgresql://user:password@host:port/dbname') - """ + """Migrate lnschema_core tables to lamindb tables.""" from urllib.parse import urlparse parsed_uri = urlparse(isettings.db) @@ -348,60 +345,62 @@ def migrate_lnschema_bionty( cur = conn.cursor() try: - # check if bionty_source table exists if db_type == "sqlite": cur.execute( - "SELECT name FROM sqlite_master WHERE type='table' AND name='bionty_source'" + "SELECT name FROM sqlite_master WHERE type='table' AND name='lamindb_user'" ) migrated = cur.fetchone() is not None # tables that need to be renamed cur.execute( - "SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'lnschema_bionty_%'" + "SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'lnschema_core_%'" ) tables_to_rename = [ - row[0][len("lnschema_bionty_") :] for row in cur.fetchall() + row[0][len("lnschema_core_") :] for row in cur.fetchall() ] else: # postgres cur.execute( - "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'bionty_source')" + "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'lamindb_user')" ) migrated = cur.fetchone()[0] # tables that need to be renamed cur.execute( - "SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'lnschema_bionty_%'" + "SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'lnschema_core_%'" ) tables_to_rename = [ - row[0][len("lnschema_bionty_") :] for row in cur.fetchall() + row[0][len("lnschema_core_") :] for row in cur.fetchall() ] if migrated: if write_file: - no_lnschema_bionty_file.touch(exist_ok=True) + no_lnschema_core_file.touch(exist_ok=True) else: try: - # rename tables only if bionty_source doesn't exist and there are tables to rename + response = input( + f"Do you want to migrate to lamindb 0.78 (integrate lnschema_core into lamindb)? (y/n) -- Will rename {tables_to_rename}" + ) + if response != "y": + print("Aborted.") + quit() for table in tables_to_rename: if db_type == "sqlite": cur.execute( - f"ALTER TABLE lnschema_bionty_{table} RENAME TO bionty_{table}" + f"ALTER TABLE lnschema_core_{table} RENAME TO lamindb_{table}" ) else: # postgres cur.execute( - f"ALTER TABLE lnschema_bionty_{table} RENAME TO bionty_{table};" + f"ALTER TABLE lnschema_core_{table} RENAME TO lamindb_{table};" ) - # update django_migrations table cur.execute( - "UPDATE django_migrations SET app = 'bionty' WHERE app = 'lnschema_bionty'" + "UPDATE django_migrations SET app = 'lamindb' WHERE app = 'lnschema_core'" ) - - logger.warning( - "Please uninstall lnschema-bionty via `pip uninstall lnschema-bionty`!" + print( + "Renaming tables finished.\nNow, *please* call: lamin migrate deploy" ) if write_file: - no_lnschema_bionty_file.touch(exist_ok=True) + no_lnschema_core_file.touch(exist_ok=True) except Exception: # read-only users can't rename tables pass diff --git a/lamindb_setup/_django.py b/lamindb_setup/_django.py index 98970e7b..aeed6b4a 100644 --- a/lamindb_setup/_django.py +++ b/lamindb_setup/_django.py @@ -5,24 +5,24 @@ def django(command: str, package_name: str | None = None, **kwargs): - r"""Manage migrations. + r"""Call Django commands. Examples: Reset auto-incrementing primary integer ids after a database import: >>> import lamindb as ln - >>> ln.setup.django("sqlsequencereset", "lnschema_core") + >>> ln.setup.django("sqlsequencereset", "lamindb") BEGIN; - SELECT setval(pg_get_serial_sequence('"lnschema_core_user"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lnschema_core_user"; # noqa - SELECT setval(pg_get_serial_sequence('"lnschema_core_storage"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lnschema_core_storage"; # noqa + SELECT setval(pg_get_serial_sequence('"lamindb_user"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lamindb_user"; # noqa + SELECT setval(pg_get_serial_sequence('"lamindb_storage"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lamindb_storage"; # noqa COMMIT; You can then run the SQL output that you'll see like so: >>> sql = \"\"\"BEGIN; - SELECT setval(pg_get_serial_sequence('"lnschema_core_user"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lnschema_core_user"; # noqa - SELECT setval(pg_get_serial_sequence('"lnschema_core_storage"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lnschema_core_storage"; # noqa + SELECT setval(pg_get_serial_sequence('"lamindb_user"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lamindb_user"; # noqa + SELECT setval(pg_get_serial_sequence('"lamindb_storage"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "lamindb_storage"; # noqa COMMIT;\"\"\" >>> from django.db import connection >>> with connection.cursor() as cursor: diff --git a/lamindb_setup/_exportdb.py b/lamindb_setup/_exportdb.py index aaf41182..39f2c3fd 100644 --- a/lamindb_setup/_exportdb.py +++ b/lamindb_setup/_exportdb.py @@ -4,7 +4,7 @@ from pathlib import Path MODELS = { - "core": { + "lamindb": { "Collection": False, "Artifact": False, "Transform": False, diff --git a/lamindb_setup/_init_instance.py b/lamindb_setup/_init_instance.py index 1eda955b..a8216184 100644 --- a/lamindb_setup/_init_instance.py +++ b/lamindb_setup/_init_instance.py @@ -2,7 +2,6 @@ import importlib import os -import sys import uuid from typing import TYPE_CHECKING, Literal from uuid import UUID @@ -29,6 +28,8 @@ def get_schema_module_name(schema_name, raise_import_error: bool = True) -> str | None: import importlib.util + if schema_name == "core": + return "lamindb" name_attempts = [f"lnschema_{schema_name.replace('-', '_')}", schema_name] for name in name_attempts: module_spec = importlib.util.find_spec(name) @@ -42,8 +43,8 @@ def get_schema_module_name(schema_name, raise_import_error: bool = True) -> str def register_storage_in_instance(ssettings: StorageSettings): - from lnschema_core.models import Storage - from lnschema_core.users import current_user_id + from lamindb.base.users import current_user_id + from lamindb.models import Storage from .core.hashing import hash_and_encode_as_b62 @@ -71,7 +72,7 @@ def register_storage_in_instance(ssettings: StorageSettings): def register_user(usettings): - from lnschema_core.models import User + from lamindb.models import User try: # need to have try except because of integer primary key migration @@ -99,35 +100,6 @@ def register_user_and_storage_in_instance(isettings: InstanceSettings, usettings logger.warning(f"instance seems not set up ({error})") -def reload_schema_modules(isettings: InstanceSettings, include_core: bool = True): - schema_names = ["core"] if include_core else [] - # schema_names += list(isettings.schema) - schema_module_names = [get_schema_module_name(n) for n in schema_names] - - for schema_module_name in schema_module_names: - if schema_module_name in sys.modules: - schema_module = importlib.import_module(schema_module_name) - importlib.reload(schema_module) - - -def reload_lamindb_itself(isettings) -> bool: - reloaded = False - if "lamindb" in sys.modules: - import lamindb - - importlib.reload(lamindb) - reloaded = True - return reloaded - - -def reload_lamindb(isettings: InstanceSettings): - log_message = settings.auto_connect - if not reload_lamindb_itself(isettings): - log_message = True - if log_message: - logger.important(f"connected lamindb: {isettings.slug}") - - ERROR_SQLITE_CACHE = """ Your cached local SQLite file exists, while your cloud SQLite file ({}) doesn't. Either delete your cache ({}) or add it back to the cloud (if delete was accidental). @@ -329,6 +301,8 @@ def init( update_schema_in_hub(access_token=access_token) if _write_settings: settings.auto_connect = True + importlib.reload(importlib.import_module("lamindb")) + logger.important(f"initialized lamindb: {isettings.slug}") except Exception as e: from ._delete import delete_by_isettings from .core._hub_core import delete_instance_record, delete_storage_record @@ -338,16 +312,17 @@ def init( delete_by_isettings(isettings) else: settings._instance_settings = None - if ( - user_handle != "anonymous" or access_token is not None - ) and isettings.is_on_hub: - delete_instance_record(isettings._id, access_token=access_token) if ( ssettings is not None and (user_handle != "anonymous" or access_token is not None) and ssettings.is_on_hub ): delete_storage_record(ssettings._uuid, access_token=access_token) # type: ignore + if isettings is not None: + if ( + user_handle != "anonymous" or access_token is not None + ) and isettings.is_on_hub: + delete_instance_record(isettings._id, access_token=access_token) raise e return None @@ -378,7 +353,6 @@ def load_from_isettings( if not isettings._get_settings_file().exists(): register_user(user) isettings._persist(write_to_disk=write_settings) - reload_lamindb(isettings) def validate_sqlite_state(isettings: InstanceSettings) -> None: diff --git a/lamindb_setup/_migrate.py b/lamindb_setup/_migrate.py index 9e83c3e0..ae54e63a 100644 --- a/lamindb_setup/_migrate.py +++ b/lamindb_setup/_migrate.py @@ -5,7 +5,7 @@ from lamin_utils import logger from packaging import version -from ._check_setup import _check_instance_setup +from . import _check_setup from .core._settings import settings from .core.django import setup_django @@ -64,16 +64,18 @@ class migrate: @classmethod def create(cls) -> None: """Create a migration.""" - if _check_instance_setup(): + if _check_setup._check_instance_setup(): raise RuntimeError("Restart Python session to create migration or use CLI!") + _check_setup.IS_LOADING = True setup_django(settings.instance, create_migrations=True) + _check_setup.IS_LOADING = False @classmethod def deploy(cls) -> None: """Deploy a migration.""" from ._schema_metadata import update_schema_in_hub - if _check_instance_setup(): + if _check_setup._check_instance_setup(): raise RuntimeError("Restart Python session to migrate or use CLI!") from lamindb_setup.core._hub_client import call_with_fallback_auth from lamindb_setup.core._hub_crud import ( diff --git a/lamindb_setup/_schema_metadata.py b/lamindb_setup/_schema_metadata.py index 039ba1cf..92cac8f5 100644 --- a/lamindb_setup/_schema_metadata.py +++ b/lamindb_setup/_schema_metadata.py @@ -232,7 +232,7 @@ def _get_related_fields_metadata(self, model, fields: list[ForeignObjectRel]): return related_fields def _get_field_metadata(self, model, field: Field): - from lnschema_core.models import LinkORM + from lamindb.models import LinkORM internal_type = field.get_internal_type() model_name = field.model._meta.model_name @@ -273,14 +273,16 @@ def _get_field_metadata(self, model, field: Field): through = self._get_through(field) return FieldMetadata( - schema_name=schema_name, + schema_name=schema_name if schema_name != "lamindb" else "core", model_name=model_name, field_name=field_name, type=internal_type, is_link_table=issubclass(field.model, LinkORM), column_name=column, relation_type=relation_type, - related_schema_name=related_schema_name, + related_schema_name=related_schema_name + if related_schema_name != "lamindb" + else "core", related_model_name=related_model_name, related_field_name=related_field_name, through=through, @@ -288,7 +290,7 @@ def _get_field_metadata(self, model, field: Field): @staticmethod def _get_through_many_to_many(field_or_rel: ManyToManyField | ManyToManyRel): - from lnschema_core.models import Registry + from lamindb.models import Registry if isinstance(field_or_rel, ManyToManyField): if field_or_rel.model != Registry: @@ -365,7 +367,7 @@ def __init__(self) -> None: def to_dict(self, include_django_objects: bool = True): return { - module_name: { + module_name if module_name != "lamindb" else "core": { model_name: model.to_dict(include_django_objects) for model_name, model in module.items() } @@ -376,7 +378,7 @@ def to_json(self): return self.to_dict(include_django_objects=False) def _get_modules_metadata(self): - from lnschema_core.models import Record, Registry + from lamindb.models import Record, Registry all_models = { module_name: { @@ -401,6 +403,8 @@ def _get_module_set_info(self): module_set_info = [] for module_name in self.included_modules: module = self._get_schema_module(module_name) + if module_name == "lamindb": + module_name = "core" module_set_info.append( {"id": 0, "name": module_name, "version": module.__version__} ) diff --git a/lamindb_setup/core/_settings.py b/lamindb_setup/core/_settings.py index cad3617c..728363ef 100644 --- a/lamindb_setup/core/_settings.py +++ b/lamindb_setup/core/_settings.py @@ -164,7 +164,7 @@ def cache_dir(self) -> UPath: @property def paths(self) -> type[SetupPaths]: - """Convert cloud paths to lamidb local paths. + """Convert cloud paths to lamindb local paths. Use `settings.paths.cloud_to_local_no_update` or `settings.paths.cloud_to_local`. diff --git a/lamindb_setup/core/_settings_instance.py b/lamindb_setup/core/_settings_instance.py index ed9b352a..575f859d 100644 --- a/lamindb_setup/core/_settings_instance.py +++ b/lamindb_setup/core/_settings_instance.py @@ -121,7 +121,7 @@ def name(self) -> str: def _search_local_root( self, local_root: str | None = None, mute_warning: bool = False ) -> StorageSettings | None: - from lnschema_core.models import Storage + from lamindb.models import Storage if local_root is not None: local_records = Storage.objects.filter(root=local_root) @@ -457,11 +457,17 @@ def _persist(self, write_to_disk: bool = True) -> None: settings._instance_settings = self def _init_db(self): + from lamindb_setup import _check_setup + from .django import setup_django + _check_setup.IS_LOADING = True setup_django(self, init=True) + _check_setup.IS_LOADING = False def _load_db(self) -> tuple[bool, str]: + from lamindb_setup import _check_setup + # Is the database available and initialized as LaminDB? # returns a tuple of status code and message if self.dialect == "sqlite" and not self._sqlite_file.exists(): @@ -472,7 +478,6 @@ def _load_db(self) -> tuple[bool, str]: f" {legacy_file} to {self._sqlite_file}" ) return False, f"SQLite file {self._sqlite_file} does not exist" - from lamindb_setup import settings # to check user from .django import setup_django @@ -481,5 +486,7 @@ def _load_db(self) -> tuple[bool, str]: # setting up django also performs a check for migrations & prints them # as warnings # this should fail, e.g., if the db is not reachable + _check_setup.IS_LOADING = True setup_django(self) + _check_setup.IS_LOADING = False return True, "" diff --git a/lamindb_setup/core/_settings_storage.py b/lamindb_setup/core/_settings_storage.py index a68ab917..d0faef2a 100644 --- a/lamindb_setup/core/_settings_storage.py +++ b/lamindb_setup/core/_settings_storage.py @@ -230,7 +230,7 @@ def record(self) -> Any: """Storage record in the current instance.""" if self._record is None: # dynamic import because of import order - from lnschema_core.models import Storage + from lamindb.models import Storage from ._settings import settings diff --git a/lamindb_setup/core/_settings_user.py b/lamindb_setup/core/_settings_user.py index f55b73d0..3b03367a 100644 --- a/lamindb_setup/core/_settings_user.py +++ b/lamindb_setup/core/_settings_user.py @@ -48,7 +48,7 @@ def __repr__(self) -> str: @property def id(self): """Integer id valid in current intance.""" - from lnschema_core.users import current_user_id + from lamindb.base.users import current_user_id # there is no cache needed here because current_user_id() # has its own cache diff --git a/lamindb_setup/core/django.py b/lamindb_setup/core/django.py index 517c4834..211b3dd7 100644 --- a/lamindb_setup/core/django.py +++ b/lamindb_setup/core/django.py @@ -5,10 +5,8 @@ import os from pathlib import Path import time -from lamin_utils import logger -from ._settings_store import current_instance_settings_file from ._settings_instance import InstanceSettings -import sys + IS_RUN_FROM_IPYTHON = getattr(builtins, "__IPYTHON__", False) IS_SETUP = False diff --git a/lamindb_setup/core/upath.py b/lamindb_setup/core/upath.py index d2bb7707..e21b5465 100644 --- a/lamindb_setup/core/upath.py +++ b/lamindb_setup/core/upath.py @@ -809,7 +809,7 @@ class InstanceNotEmpty(Exception): pass -# is as fast as boto3: https://lamin.ai/laminlabs/lamindata/transform/krGp3hT1f78N5zKv +# is as fast as boto3: https://lamin.ai/laminlabs/lamin-site-assets/transform/krGp3hT1f78N5zKv def check_storage_is_empty( root: UPathStr, *, raise_error: bool = True, account_for_sqlite_file: bool = False ) -> int: diff --git a/noxfile.py b/noxfile.py index c7f85cab..0aef26a6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,19 +27,16 @@ def lint(session: nox.Session) -> None: ["hub-local", "hub-prod", "hub-cloud", "storage", "docs"], ) def install(session: nox.Session, group: str) -> None: - no_deps_packages = "git+https://github.com/laminlabs/lnschema-core git+https://github.com/laminlabs/wetlab git+https://github.com/laminlabs/lamin-cli" - schema_deps = f"""uv pip install --system git+https://github.com/laminlabs/bionty git+https://github.com/laminlabs/lamindb + no_deps_packages = "git+https://github.com/laminlabs/lamindb@integrate-lnschema-core git+https://github.com/laminlabs/wetlab@integrate-lnschema-core git+https://github.com/laminlabs/lamin-cli" + schema_deps = f"""uv pip install --system git+https://github.com/laminlabs/bionty@integrate-lnschema-core uv pip install --system --no-deps {no_deps_packages} """ if group == "hub-cloud": cmds = schema_deps + "uv pip install --system ./laminhub/rest-hub line_profiler" elif group == "docs": - cmds = ( - """uv pip install --system git+https://github.com/laminlabs/lnschema-core""" - ) + cmds = """uv pip install --system git+https://github.com/laminlabs/lamindb@integrate-lnschema-core""" elif group == "storage": - cmds = """uv pip install --system gcsfs""" - cmds += """\nuv pip install --system huggingface_hub""" + cmds = schema_deps + "uv pip install --system gcsfs huggingface_hub" elif group == "hub-prod": # cmds = "git clone --depth 1 https://github.com/django/django\n" # cmds += "uv pip install --system -e ./django\n" diff --git a/pyproject.toml b/pyproject.toml index bc1d09a3..485e14aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ authors = [{name = "Lamin Labs", email = "open-source@lamin.ai"}] readme = "README.md" dynamic = ["version", "description"] dependencies = [ - "lnschema_core>=0.51.0", "lamin_utils>=0.3.3", # External dependencies "django>4.2,<5.3.0", diff --git a/tests/hub-cloud/scripts/script-to-fail-managed-storage.py b/tests/hub-cloud/scripts/script-to-fail-managed-storage.py index a0aa0f9f..9960d31d 100644 --- a/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +++ b/tests/hub-cloud/scripts/script-to-fail-managed-storage.py @@ -15,7 +15,7 @@ with pytest.raises(ProgrammingError) as error: set_managed_storage(test_root) assert error.exconly().endswith( - "ProgrammingError: permission denied for table lnschema_core_storage" + "ProgrammingError: permission denied for table lamindb_storage" ) hub_client = connect_hub_with_auth() diff --git a/tests/hub-local/test_update_schema_in_hub.py b/tests/hub-local/test_update_schema_in_hub.py index d2451f12..ff52e0c5 100644 --- a/tests/hub-local/test_update_schema_in_hub.py +++ b/tests/hub-local/test_update_schema_in_hub.py @@ -129,7 +129,7 @@ def test_update_schema_in_hub(setup_instance): "through": { "left_key": "from_transform_id", "right_key": "to_transform_id", - "link_table_name": "lnschema_core_transform_predecessors", + "link_table_name": "lamindb_transform_predecessors", }, "field_name": "predecessors", "model_name": "transform", @@ -147,7 +147,7 @@ def test_update_schema_in_hub(setup_instance): "through": { "left_key": "to_transform_id", "right_key": "from_transform_id", - "link_table_name": "lnschema_core_transform_predecessors", + "link_table_name": "lamindb_transform_predecessors", }, "field_name": "successors", "model_name": "transform", diff --git a/tests/hub-prod/test_django.py b/tests/hub-prod/test_django.py index 66b598f9..4045455a 100644 --- a/tests/hub-prod/test_django.py +++ b/tests/hub-prod/test_django.py @@ -6,4 +6,4 @@ def test_django(): - django("sqlsequencereset", "lnschema_core") + django("sqlsequencereset", "lamindb")