lamindb_setup 1.1.1__py3-none-any.whl → 1.2.0__py3-none-any.whl

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.
lamindb_setup/__init__.py CHANGED
@@ -33,7 +33,7 @@ Modules & settings:
33
33
 
34
34
  """
35
35
 
36
- __version__ = "1.1.1" # denote a release candidate for 0.1.0 with 0.1rc1
36
+ __version__ = "1.2.0" # denote a release candidate for 0.1.0 with 0.1rc1
37
37
 
38
38
  import os
39
39
 
@@ -148,6 +148,8 @@ class FieldMetadata(BaseModel):
148
148
  model_name: str
149
149
  schema_name: str
150
150
  is_link_table: bool
151
+ is_primary_key: bool
152
+ is_editable: bool
151
153
  relation_type: RelationType | None = None
152
154
  related_field_name: str | None = None
153
155
  related_model_name: str | None = None
@@ -156,6 +158,8 @@ class FieldMetadata(BaseModel):
156
158
 
157
159
  class _ModelHandler:
158
160
  def __init__(self, model, module_name: str, included_modules: list[str]) -> None:
161
+ from lamindb.models import LinkORM
162
+
159
163
  self.model = model
160
164
  self.class_name = model.__name__
161
165
  self.module_name = module_name
@@ -163,12 +167,14 @@ class _ModelHandler:
163
167
  self.table_name = model._meta.db_table
164
168
  self.included_modules = included_modules
165
169
  self.fields = self._get_fields_metadata(self.model)
170
+ self.is_link_table = issubclass(model, LinkORM)
166
171
 
167
172
  def to_dict(self, include_django_objects: bool = True):
168
173
  _dict = {
169
174
  "fields": self.fields.copy(),
170
175
  "class_name": self.class_name,
171
176
  "table_name": self.table_name,
177
+ "is_link_table": self.is_link_table,
172
178
  }
173
179
 
174
180
  for field_name in self.fields.keys():
@@ -242,13 +248,16 @@ class _ModelHandler:
242
248
  related_model_name = None
243
249
  related_schema_name = None
244
250
  related_field_name = None
245
- field_name = field.name
251
+ is_editable = field.editable
246
252
  else:
247
253
  related_model_name = field.related_model._meta.model_name
248
254
  related_schema_name = field.related_model.__get_module_name__()
249
255
  schema_name = field.model.__get_module_name__()
250
256
  related_field_name = field.remote_field.name
251
- field_name = field.name
257
+ is_editable = False
258
+
259
+ field_name = field.name
260
+ is_primary_key = getattr(field, "primary_key", False)
252
261
 
253
262
  if relation_type in ["one-to-many"]:
254
263
  # For a one-to-many relation, the field belong
@@ -278,6 +287,8 @@ class _ModelHandler:
278
287
  field_name=field_name,
279
288
  type=internal_type,
280
289
  is_link_table=issubclass(field.model, LinkORM),
290
+ is_primary_key=is_primary_key,
291
+ is_editable=is_editable,
281
292
  column_name=column,
282
293
  relation_type=relation_type,
283
294
  related_schema_name=related_schema_name
@@ -125,7 +125,13 @@ class AWSOptionsManager:
125
125
 
126
126
  def enrich_path(self, path: UPath, access_token: str | None = None) -> UPath:
127
127
  # ignore paths with non-lamin-managed endpoints
128
- if path.storage_options.get("endpoint_url", None) not in LAMIN_ENDPOINTS:
128
+ if (
129
+ endpoint_url := path.storage_options.get("endpoint_url", None)
130
+ ) not in LAMIN_ENDPOINTS:
131
+ if "r2.cloudflarestorage.com" in endpoint_url:
132
+ # fixed_upload_size should always be True for R2
133
+ # this option is needed for correct uploads to R2
134
+ path = UPath(path, fixed_upload_size=True)
129
135
  return path
130
136
  # trailing slash is needed to avoid returning incorrect results
131
137
  # with .startswith
@@ -517,7 +517,7 @@ def modified(self) -> datetime | None:
517
517
 
518
518
 
519
519
  def compute_file_tree(
520
- path: Path,
520
+ path: UPath,
521
521
  *,
522
522
  level: int = -1,
523
523
  only_dirs: bool = False,
@@ -526,6 +526,11 @@ def compute_file_tree(
526
526
  include_paths: set[Any] | None = None,
527
527
  skip_suffixes: list[str] | None = None,
528
528
  ) -> tuple[str, int]:
529
+ # .exists() helps to separate files from folders for gcsfs
530
+ # otherwise sometimes it has is_dir() True and is_file() True
531
+ if path.protocol == "gs" and not path.exists():
532
+ raise FileNotFoundError
533
+
529
534
  space = " "
530
535
  branch = "│ "
531
536
  tee = "├── "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 1.1.1
3
+ Version: 1.2.0
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10
@@ -1,4 +1,4 @@
1
- lamindb_setup/__init__.py,sha256=6TuxQ39LS6eQzygoAXTY6B7NyqslymPPePkClF5BLss,2692
1
+ lamindb_setup/__init__.py,sha256=MRSpN8Ae0WGaQ95nuc8sR9v4WWiMFYMaNB9-iVCVmCU,2692
2
2
  lamindb_setup/_cache.py,sha256=aszT-zk3S5dTLKp5g1W-S_FPh2E5YVCALwWSGPJLWBM,1493
3
3
  lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
4
4
  lamindb_setup/_check_setup.py,sha256=d1GS1Csy2G9AysfjoyVcNVY0lhHiWSwSLpfgdIQf35s,5477
@@ -13,12 +13,12 @@ lamindb_setup/_init_instance.py,sha256=nZkqGqJQ_sF1-oQmnbpIjP1ExWUow5I5N7lsyX9m-
13
13
  lamindb_setup/_migrate.py,sha256=drf7Lsa8oDXBPBWMWMge0n5VyNPvsrCFAhcXlN91OxM,9165
14
14
  lamindb_setup/_register_instance.py,sha256=alQuYp2f8Ct8xvRC1gt8p_HZ0tqCd3gZD3kiPBLPpsI,1269
15
15
  lamindb_setup/_schema.py,sha256=b3uzhhWpV5mQtDwhMINc2MabGCnGLESy51ito3yl6Wc,679
16
- lamindb_setup/_schema_metadata.py,sha256=7ITlzIK32GHdhMq9e0GtPM3QbzJWhUvzPutiHrjjPk0,13986
16
+ lamindb_setup/_schema_metadata.py,sha256=cDkNHyFTFZq879UGY6i-rJEXfeBN59AN3Wz86caKnYI,14358
17
17
  lamindb_setup/_set_managed_storage.py,sha256=4tDxXQMt8Gw028uY3vIQxZQ7qBNXhQMc8saarNK_Z-s,2043
18
18
  lamindb_setup/_setup_user.py,sha256=-g7Xj6510BDyM8kuqAsVBZFwehlhBa_uWBSV1rPeuM8,4586
19
19
  lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
20
20
  lamindb_setup/core/__init__.py,sha256=BxIVMX5HQq8oZ1OuY_saUEJz5Tdd7gaCPngxVu5iou4,417
21
- lamindb_setup/core/_aws_options.py,sha256=Evu8W9Xcr1_vYKo3Vfsv03dmD4x3itaPyWY8fBOrYcE,6954
21
+ lamindb_setup/core/_aws_options.py,sha256=Umxu_1AYd-0LJUElZxowvE9vNA7Z8kh_63g3pp1gfd8,7243
22
22
  lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-OqbfwM0,1799
23
23
  lamindb_setup/core/_deprecated.py,sha256=HN7iUBdEgahw5e4NHCd1VJooUfieNb6GRzS5x8jU-q8,2549
24
24
  lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
@@ -40,8 +40,8 @@ lamindb_setup/core/django.py,sha256=jSbckc_R39BhnANGhO5YFzKA8BHNANJDDgS5rwkDWmU,
40
40
  lamindb_setup/core/exceptions.py,sha256=4NpLUNUIfXYVTFX2FvLZF8RW34exk2Vn2X3G4YhnTRg,276
41
41
  lamindb_setup/core/hashing.py,sha256=M3Q1-ywnqh4Uy5zojbQfLju19HU0ySp8Oi7FGIJXfFI,3667
42
42
  lamindb_setup/core/types.py,sha256=zJii2le38BJUmsNVvzDrbzGYr0yaeb-9Rw9IKmsBr3k,523
43
- lamindb_setup/core/upath.py,sha256=FUCBicCTAUPq-3lFwcDPngRLrNGfqQEn7l9ZCLjkz3Y,33335
44
- lamindb_setup-1.1.1.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
45
- lamindb_setup-1.1.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
46
- lamindb_setup-1.1.1.dist-info/METADATA,sha256=dn4Sbq-u6AoTsN06Sfa0jlbWPt41MBMsBqqdEnVS13U,1770
47
- lamindb_setup-1.1.1.dist-info/RECORD,,
43
+ lamindb_setup/core/upath.py,sha256=AvRmICPBxQx-2iQYsXDFsrJS-AAUNuw6IymLcVmkWvo,33550
44
+ lamindb_setup-1.2.0.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
45
+ lamindb_setup-1.2.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
46
+ lamindb_setup-1.2.0.dist-info/METADATA,sha256=H2PukxHB627ci1LuXmRMSXrUbZlZKntb7YkLjKS72Yw,1770
47
+ lamindb_setup-1.2.0.dist-info/RECORD,,