lamindb_setup 1.13.1__tar.gz → 1.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/PKG-INFO +1 -1
  2. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/__init__.py +18 -18
  3. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/__init__.py +6 -11
  4. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_hub_core.py +7 -2
  5. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings.py +30 -0
  6. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/upath.py +17 -12
  7. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/errors.py +8 -11
  8. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/types.py +2 -5
  9. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-local/scripts/script-connect-fine-grained-access.py +3 -0
  10. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/.github/workflows/build.yml +0 -0
  11. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/.github/workflows/doc-changes.yml +0 -0
  12. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/.gitignore +0 -0
  13. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/.pre-commit-config.yaml +0 -0
  14. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/LICENSE +0 -0
  15. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/README.md +0 -0
  16. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/changelog.md +0 -0
  17. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/01-init-local-instance.ipynb +0 -0
  18. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/02-connect-local-instance.ipynb +0 -0
  19. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/03-add-managed-storage.ipynb +0 -0
  20. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
  21. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
  22. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
  23. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/07-keep-artifacts-local.ipynb +0 -0
  24. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/08-test-multi-session.ipynb +0 -0
  25. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/09-test-migrate.ipynb +0 -0
  26. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-cloud/test_notebooks.py +0 -0
  27. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-cache-management.ipynb +0 -0
  28. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
  29. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
  30. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-empty-init.ipynb +0 -0
  31. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-import-schema.ipynb +0 -0
  32. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
  33. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
  34. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
  35. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
  36. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/hub-prod/test_notebooks2.py +0 -0
  37. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/index.md +0 -0
  38. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/notebooks.md +0 -0
  39. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/docs/reference.md +0 -0
  40. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_cache.py +0 -0
  41. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_check.py +0 -0
  42. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_check_setup.py +0 -0
  43. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_connect_instance.py +0 -0
  44. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_delete.py +0 -0
  45. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_disconnect.py +0 -0
  46. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_django.py +0 -0
  47. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_entry_points.py +0 -0
  48. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_exportdb.py +0 -0
  49. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_importdb.py +0 -0
  50. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_init_instance.py +0 -0
  51. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_migrate.py +0 -0
  52. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_register_instance.py +0 -0
  53. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_schema.py +0 -0
  54. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_schema_metadata.py +0 -0
  55. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_set_managed_storage.py +0 -0
  56. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_setup_user.py +0 -0
  57. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/_silence_loggers.py +0 -0
  58. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_aws_options.py +0 -0
  59. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_aws_storage.py +0 -0
  60. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_clone.py +0 -0
  61. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_deprecated.py +0 -0
  62. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_docs.py +0 -0
  63. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_hub_client.py +0 -0
  64. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_hub_crud.py +0 -0
  65. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_hub_utils.py +0 -0
  66. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_private_django_api.py +0 -0
  67. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_instance.py +0 -0
  68. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_load.py +0 -0
  69. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_save.py +0 -0
  70. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_storage.py +0 -0
  71. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_store.py +0 -0
  72. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_settings_user.py +0 -0
  73. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
  74. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/cloud_sqlite_locker.py +0 -0
  75. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/django.py +0 -0
  76. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/exceptions.py +0 -0
  77. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/hashing.py +0 -0
  78. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/core/types.py +0 -0
  79. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/lamindb_setup/py.typed +0 -0
  80. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/noxfile.py +0 -0
  81. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/pyproject.toml +0 -0
  82. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
  83. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
  84. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_clone_instance.py +0 -0
  85. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_connect_instance.py +0 -0
  86. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_delete_instance.py +0 -0
  87. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_edge_request.py +0 -0
  88. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
  89. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_init_instance.py +0 -0
  90. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_init_pass_user_no_writes.py +0 -0
  91. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_login.py +0 -0
  92. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-cloud/test_set_storage.py +0 -0
  93. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-local/README.md +0 -0
  94. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-local/conftest.py +0 -0
  95. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-local/test_all.py +0 -0
  96. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-local/test_update_schema_in_hub.py +0 -0
  97. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/conftest.py +0 -0
  98. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_aws_options_manager.py +0 -0
  99. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_django.py +0 -0
  100. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_global_settings.py +0 -0
  101. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_migrate.py +0 -0
  102. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
  103. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/hub-prod/test_upath.py +0 -0
  104. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_entry_point.py +0 -0
  105. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_hashing.py +0 -0
  106. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_storage_access.py +0 -0
  107. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_storage_basis.py +0 -0
  108. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_storage_settings.py +0 -0
  109. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_storage_stats.py +0 -0
  110. {lamindb_setup-1.13.1 → lamindb_setup-1.14.0}/tests/storage/test_to_url.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 1.13.1
3
+ Version: 1.14.0
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10
@@ -4,25 +4,17 @@ Many functions in this "setup API" have a matching command in the :doc:`docs:cli
4
4
 
5
5
  Guide: :doc:`docs:setup`.
6
6
 
7
- Basic operations:
7
+ Basic operations
8
+ ----------------
8
9
 
9
- .. autosummary::
10
- :toctree:
10
+ .. autofunction:: login
11
+ .. autofunction:: logout
12
+ .. autofunction:: init
13
+ .. autofunction:: disconnect
14
+ .. autofunction:: delete
11
15
 
12
- login
13
- logout
14
- init
15
- disconnect
16
- delete
17
-
18
- Instance operations:
19
-
20
- .. autosummary::
21
- :toctree:
22
-
23
- migrate
24
-
25
- Modules & settings:
16
+ Modules & settings
17
+ ------------------
26
18
 
27
19
  .. autosummary::
28
20
  :toctree:
@@ -33,9 +25,17 @@ Modules & settings:
33
25
  errors
34
26
  types
35
27
 
28
+ Migration management
29
+ --------------------
30
+
31
+ .. autosummary::
32
+ :toctree:
33
+
34
+ migrate
35
+
36
36
  """
37
37
 
38
- __version__ = "1.13.1" # denote a release candidate for 0.1.0 with 0.1rc1
38
+ __version__ = "1.14.0" # denote a release candidate for 0.1.0 with 0.1rc1
39
39
 
40
40
  import os
41
41
  import warnings
@@ -1,21 +1,16 @@
1
1
  """Core setup library.
2
2
 
3
- Settings:
4
-
5
- .. autosummary::
6
- :toctree:
7
-
8
- SetupSettings
9
- UserSettings
10
- InstanceSettings
11
- StorageSettings
3
+ .. autoclass:: SetupSettings
4
+ .. autoclass:: UserSettings
5
+ .. autoclass:: InstanceSettings
6
+ .. autoclass:: StorageSettings
12
7
 
13
8
  """
14
9
 
15
10
  from . import django, upath
16
11
  from ._clone import connect_local_sqlite, init_local_sqlite
17
- from ._deprecated import deprecated
18
- from ._docs import doc_args
12
+ from ._deprecated import deprecated # documented in lamindb.base
13
+ from ._docs import doc_args # documented in lamindb.base
19
14
  from ._settings import SetupSettings
20
15
  from ._settings_instance import InstanceSettings
21
16
  from ._settings_storage import StorageSettings
@@ -551,6 +551,9 @@ def _connect_instance_hub(
551
551
  db_user["password" if fine_grained_access else "db_user_password"],
552
552
  )
553
553
 
554
+ db_user_name = "none" if db_user_name is None else db_user_name
555
+ db_user_password = "none" if db_user_password is None else db_user_password
556
+
554
557
  if use_proxy_db:
555
558
  host = instance.get("proxy_host", None)
556
559
  assert host is not None, (
@@ -560,14 +563,16 @@ def _connect_instance_hub(
560
563
  assert port is not None, (
561
564
  "Database proxy port is not available, please do not pass 'use_proxy_db'."
562
565
  )
566
+ # remove supabase project id if present
567
+ db_user_name = db_user_name.rsplit(".", 1)[0]
563
568
  else:
564
569
  host = instance["db_host"]
565
570
  port = instance["db_port"]
566
571
 
567
572
  db_dsn = LaminDsn.build(
568
573
  scheme=instance["db_scheme"],
569
- user=db_user_name if db_user_name is not None else "none",
570
- password=db_user_password if db_user_password is not None else "none",
574
+ user=db_user_name,
575
+ password=db_user_password,
571
576
  host=host,
572
577
  port=port,
573
578
  database=instance["db_database"],
@@ -5,6 +5,7 @@ import sys
5
5
  from pathlib import Path
6
6
  from typing import TYPE_CHECKING
7
7
 
8
+ import jwt
8
9
  from lamin_utils import logger
9
10
  from platformdirs import user_cache_dir
10
11
 
@@ -319,6 +320,35 @@ class SetupSettings:
319
320
  """
320
321
  return SetupPaths
321
322
 
323
+ def _debug_db_access(self):
324
+ """Debug database access problems."""
325
+ instance = self.instance
326
+ db_permissions = instance._db_permissions
327
+ print("db connection: ", instance.db)
328
+ print("db permissions: ", db_permissions)
329
+ if db_permissions != "jwt":
330
+ return
331
+ # sets the token if not present yet
332
+ print("available spaces: ", instance.available_spaces)
333
+
334
+ from lamindb_setup.core.django import db_token_manager
335
+
336
+ tokens = db_token_manager.tokens
337
+ if tokens:
338
+ for conn, token in tokens.items():
339
+ token_encoded = token._token
340
+ if token_encoded is None:
341
+ token._refresh_token()
342
+ token_encoded = token._token
343
+ token_decoded = jwt.decode(
344
+ token_encoded, options={"verify_signature": False}
345
+ )
346
+ print(
347
+ f"db token for the connection '{conn}' is '{token_encoded}': {token_decoded}"
348
+ )
349
+ else:
350
+ print("no db tokens are present")
351
+
322
352
  def __repr__(self) -> str:
323
353
  """Rich string representation."""
324
354
  from lamin_utils import colors
@@ -737,25 +737,30 @@ UPath.exists.__doc__ = Path.exists.__doc__
737
737
  UPath.is_dir.__doc__ = Path.is_dir.__doc__
738
738
  UPath.is_file.__doc__ = Path.is_file.__doc__
739
739
  UPath.unlink.__doc__ = Path.unlink.__doc__
740
- UPath.rename.__doc__ = """Move file, see fsspec.AbstractFileSystem.mv.
740
+ UPath.rename.__doc__ = """Move file, see `fsspec.AbstractFileSystem.mv`.
741
741
 
742
- >>> upath = Upath("s3://my-bucket/my-file")
743
- >>> upath.rename(UPath("s3://my-bucket/my-file-renamed"))
744
- >>> upath.rename("my-file-renamed")
742
+ For example::
745
743
 
746
- >>> upath = Upath("local-folder/my-file")
747
- >>> upath.rename("local-folder/my-file-renamed")
744
+ upath = UPath("s3://my-bucket/my-file")
745
+ upath.rename(UPath("s3://my-bucket/my-file-renamed"))
746
+ upath.rename("my-file-renamed")
748
747
  """
749
- UPath.__doc__ = """Paths: low-level key-value access to files/objects.
748
+ UPath.__doc__ = """Paths: low-level key-value access to files.
750
749
 
751
- Paths are based on keys that offer the typical access patterns of file systems
752
- and object stores.
750
+ Offers the typical access patterns of file systems and object stores, for instance::
753
751
 
754
- >>> upath = UPath("s3://my-bucket/my-folder")
755
- >>> upath.exists()
752
+ upath = UPath("s3://my-bucket/my-folder/my-file.txt")
753
+ upath.exists() # file exists in storage
754
+
755
+ LaminDB exposes `universal_pathlib.UPath` and adds functionality related to authentication and the following methods::
756
+
757
+ upath.view_tree() # view a file tree
758
+ upath.upload_from("local-file.txt") # upload a local file
759
+ upath.download_to("local-file.txt") # download a file
760
+ upath.synchronize_to("local-folder/") # synchronize a folder
756
761
 
757
762
  Args:
758
- pathlike: A string or Path to a local/cloud file/directory/folder.
763
+ pathlike: A string or `Path` to a local or cloud file/directory/folder.
759
764
  """
760
765
 
761
766
  logger.debug("upath.UPath has been patched")
@@ -1,16 +1,13 @@
1
1
  """Errors.
2
2
 
3
- .. autosummary::
4
- :toctree: .
5
-
6
- CurrentInstanceNotConfigured
7
- InstanceNotSetupError
8
- ModuleWasntConfigured
9
- StorageAlreadyManaged
10
- StorageNotEmpty
11
- InstanceLockedException
12
- SettingsEnvFileOutdated
13
- CannotSwitchDefaultInstance
3
+ .. autoexception:: CurrentInstanceNotConfigured
4
+ .. autoexception:: InstanceNotSetupError
5
+ .. autoexception:: ModuleWasntConfigured
6
+ .. autoexception:: StorageAlreadyManaged
7
+ .. autoexception:: StorageNotEmpty
8
+ .. autoexception:: InstanceLockedException
9
+ .. autoexception:: SettingsEnvFileOutdated
10
+ .. autoexception:: CannotSwitchDefaultInstance
14
11
 
15
12
  """
16
13
 
@@ -1,10 +1,7 @@
1
1
  """Types.
2
2
 
3
- .. autosummary::
4
- :toctree: .
5
-
6
- UPathStr
7
- StorageType
3
+ .. autoclass:: UPathStr
4
+ .. autoclass:: StorageType
8
5
  """
9
6
 
10
7
  from __future__ import annotations
@@ -41,6 +41,9 @@ with connection.cursor() as cur:
41
41
  # check available spaces call
42
42
  assert ln_setup.settings.instance.available_spaces
43
43
 
44
+ # run debug function for coverage
45
+ ln_setup.settings._debug_db_access()
46
+
44
47
  # check reset
45
48
  db_token_manager.reset()
46
49
  assert not db_token_manager.tokens
File without changes
File without changes