lamindb_setup 0.77.0__tar.gz → 0.77.1__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 (97) hide show
  1. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/PKG-INFO +1 -1
  2. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/__init__.py +5 -1
  3. lamindb_setup-0.77.1/lamindb_setup/_entry_points.py +22 -0
  4. lamindb_setup-0.77.1/tests/storage/test_entry_point.py +76 -0
  5. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/.github/workflows/build.yml +0 -0
  6. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/.github/workflows/doc-changes.yml +0 -0
  7. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/.gitignore +0 -0
  8. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/.pre-commit-config.yaml +0 -0
  9. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/LICENSE +0 -0
  10. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/README.md +0 -0
  11. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/changelog.md +0 -0
  12. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/01-init-local-instance.ipynb +0 -0
  13. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/02-connect-local-instance.ipynb +0 -0
  14. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/03-add-managed-storage.ipynb +0 -0
  15. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
  16. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
  17. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
  18. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/07-keep-artifacts-local.ipynb +0 -0
  19. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/08-test-multi-session.ipynb +0 -0
  20. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-cloud/test_notebooks.py +0 -0
  21. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-cache-management.ipynb +0 -0
  22. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
  23. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
  24. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-empty-init.ipynb +0 -0
  25. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-import-schema.ipynb +0 -0
  26. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
  27. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
  28. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
  29. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
  30. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/hub-prod/test_notebooks2.py +0 -0
  31. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/index.md +0 -0
  32. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/notebooks.md +0 -0
  33. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/docs/reference.md +0 -0
  34. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_cache.py +0 -0
  35. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_check.py +0 -0
  36. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_check_setup.py +0 -0
  37. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_close.py +0 -0
  38. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_connect_instance.py +0 -0
  39. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_delete.py +0 -0
  40. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_django.py +0 -0
  41. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_exportdb.py +0 -0
  42. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_importdb.py +0 -0
  43. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_init_instance.py +0 -0
  44. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_migrate.py +0 -0
  45. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_register_instance.py +0 -0
  46. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_schema.py +0 -0
  47. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_schema_metadata.py +0 -0
  48. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_set_managed_storage.py +0 -0
  49. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_setup_user.py +0 -0
  50. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/_silence_loggers.py +0 -0
  51. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/__init__.py +0 -0
  52. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_aws_credentials.py +0 -0
  53. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_aws_storage.py +0 -0
  54. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_deprecated.py +0 -0
  55. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_docs.py +0 -0
  56. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_hub_client.py +0 -0
  57. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_hub_core.py +0 -0
  58. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_hub_crud.py +0 -0
  59. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_hub_utils.py +0 -0
  60. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_private_django_api.py +0 -0
  61. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings.py +0 -0
  62. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_instance.py +0 -0
  63. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_load.py +0 -0
  64. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_save.py +0 -0
  65. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_storage.py +0 -0
  66. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_store.py +0 -0
  67. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_settings_user.py +0 -0
  68. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
  69. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/cloud_sqlite_locker.py +0 -0
  70. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/django.py +0 -0
  71. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/exceptions.py +0 -0
  72. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/hashing.py +0 -0
  73. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/types.py +0 -0
  74. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/lamindb_setup/core/upath.py +0 -0
  75. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/noxfile.py +0 -0
  76. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/pyproject.toml +0 -0
  77. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
  78. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_connect_instance.py +0 -0
  79. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_delete_instance.py +0 -0
  80. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
  81. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_init_instance.py +0 -0
  82. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_login.py +0 -0
  83. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_migrate.py +0 -0
  84. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-cloud/test_set_storage.py +0 -0
  85. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-local/conftest.py +0 -0
  86. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-local/test_all.py +0 -0
  87. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-local/test_update_schema_in_hub.py +0 -0
  88. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-prod/conftest.py +0 -0
  89. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-prod/test_django.py +0 -0
  90. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-prod/test_global_settings.py +0 -0
  91. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
  92. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/hub-prod/test_upath.py +0 -0
  93. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/storage/test_hashing.py +0 -0
  94. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/storage/test_storage_access.py +0 -0
  95. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/storage/test_storage_basis.py +0 -0
  96. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/storage/test_storage_stats.py +0 -0
  97. {lamindb_setup-0.77.0 → lamindb_setup-0.77.1}/tests/storage/test_to_url.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb_setup
3
- Version: 0.77.0
3
+ Version: 0.77.1
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Description-Content-Type: text/markdown
@@ -34,7 +34,7 @@ Modules & settings:
34
34
 
35
35
  """
36
36
 
37
- __version__ = "0.77.0" # denote a release candidate for 0.1.0 with 0.1rc1
37
+ __version__ = "0.77.1" # denote a release candidate for 0.1.0 with 0.1rc1
38
38
 
39
39
  import os as _os
40
40
  import sys as _sys
@@ -45,6 +45,7 @@ from ._close import close
45
45
  from ._connect_instance import connect, load
46
46
  from ._delete import delete
47
47
  from ._django import django
48
+ from ._entry_points import call_registered_entry_points as _call_registered_entry_points
48
49
  from ._init_instance import init
49
50
  from ._migrate import migrate
50
51
  from ._register_instance import register
@@ -68,4 +69,7 @@ if _os.name == "nt":
68
69
 
69
70
  threading.excepthook = _except_hook
70
71
 
72
+ # provide a way for other packages to run custom code on import
73
+ _call_registered_entry_points("lamindb_setup.on_import")
74
+
71
75
  settings.__doc__ = """Global :class:`~lamindb.setup.core.SetupSettings`."""
@@ -0,0 +1,22 @@
1
+ import sys
2
+ import warnings
3
+ from importlib.metadata import entry_points
4
+
5
+
6
+ def call_registered_entry_points(group, **kwargs):
7
+ """load and call entry points registered under group."""
8
+ if sys.version_info >= (3, 10):
9
+ eps = entry_points(group=group)
10
+ else:
11
+ eps = entry_points().get(group, [])
12
+
13
+ for ep in eps:
14
+ func = ep.load()
15
+ try:
16
+ func(**kwargs)
17
+ except BaseException as e:
18
+ warnings.warn(
19
+ f"Error loading entry point of group {group!r}: {ep} -> {e}",
20
+ RuntimeWarning,
21
+ stacklevel=2,
22
+ )
@@ -0,0 +1,76 @@
1
+ import shlex
2
+ import subprocess
3
+ import sys
4
+
5
+ import pytest
6
+
7
+ pyproject_toml = """\
8
+ [project]
9
+ name = "my_custom_module"
10
+ version = "0.0.1"
11
+
12
+ # pyproject.toml
13
+ [project.entry-points."lamindb_setup.on_import"]
14
+ my_custom_function = "my_custom_module:my_custom_function"
15
+ """
16
+
17
+ my_custom_module = """\
18
+ import os
19
+
20
+ def my_custom_function():
21
+ os.environ["MY_CUSTOM_ENV_VAR"] = "1"
22
+ """
23
+
24
+
25
+ @pytest.fixture
26
+ def installed_custom_module(tmp_path):
27
+ (tmp_path / "pyproject.toml").write_text(pyproject_toml)
28
+ (tmp_path / "my_custom_module.py").write_text(my_custom_module)
29
+ cmd_install = [sys.executable, "-m", "pip", "install", str(tmp_path)]
30
+ cmd_cleanup = [sys.executable, "-m", "pip", "uninstall", "my_custom_module", "-y"]
31
+
32
+ subprocess.run(shlex.join(cmd_install), shell=True, check=True)
33
+ try:
34
+ yield
35
+ finally:
36
+ subprocess.run(shlex.join(cmd_cleanup), shell=True, check=True)
37
+
38
+
39
+ @pytest.mark.parametrize(
40
+ "output,install_custom",
41
+ [
42
+ pytest.param(b"0", False, id="no-entry-point"),
43
+ pytest.param(b"1", True, id="with-entry-point"),
44
+ ],
45
+ )
46
+ def test_on_import_entry_point(output, install_custom, request):
47
+ if install_custom:
48
+ request.getfixturevalue("installed_custom_module")
49
+
50
+ cmd = [
51
+ sys.executable,
52
+ "-c",
53
+ "import lamindb_setup; import os; print(os.environ.get('MY_CUSTOM_ENV_VAR', '0'), end='')",
54
+ ]
55
+ out = subprocess.run(
56
+ shlex.join(cmd),
57
+ shell=True,
58
+ capture_output=True,
59
+ env={"PYTHONWARNINGS": "error"},
60
+ )
61
+ assert out.returncode == 0
62
+ assert out.stderr == b""
63
+ assert out.stdout == output
64
+
65
+
66
+ def test_call_registered_entry_points(installed_custom_module):
67
+ from lamindb_setup._entry_points import call_registered_entry_points
68
+
69
+ call_registered_entry_points("lamindb_setup.on_import")
70
+
71
+
72
+ def test_broken_entry_points_does_not_crash(installed_custom_module):
73
+ from lamindb_setup._entry_points import call_registered_entry_points
74
+
75
+ with pytest.warns(RuntimeWarning, match="Error loading entry point"):
76
+ call_registered_entry_points("lamindb_setup.on_import", broken_kwarg=object())
File without changes
File without changes