lamin_cli 0.21.1__py2.py3-none-any.whl → 0.21.2__py2.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.
lamin_cli/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Lamin CLI."""
2
2
 
3
- __version__ = "0.21.1"
3
+ __version__ = "0.21.2"
lamin_cli/_save.py CHANGED
@@ -10,7 +10,10 @@ def parse_uid_from_code(
10
10
  content: str, suffix: str
11
11
  ) -> tuple[str | None, str | None, str | None]:
12
12
  if suffix == ".py":
13
- track_pattern = re.compile(r'ln\.track\(\s*(?:uid\s*=\s*)?["\']([^"\']+)["\']')
13
+ track_pattern = re.compile(
14
+ r'ln\.track\(\s*(?:transform\s*=\s*)?(["\'])([a-zA-Z0-9]{16})\1'
15
+ )
16
+ # backward compat
14
17
  uid_pattern = re.compile(r'\.context\.uid\s*=\s*["\']([^"\']+)["\']')
15
18
  stem_uid_pattern = re.compile(
16
19
  r'\.transform\.stem_uid\s*=\s*["\']([^"\']+)["\']'
@@ -18,8 +21,9 @@ def parse_uid_from_code(
18
21
  version_pattern = re.compile(r'\.transform\.version\s*=\s*["\']([^"\']+)["\']')
19
22
  elif suffix == ".ipynb":
20
23
  track_pattern = re.compile(
21
- r'ln\.track\(\s*(?:uid\s*=\s*)?\\["\']([^"\']+)\\["\']'
24
+ r'ln\.track\(\s*(?:transform\s*=\s*)?(?:\\"|\')([a-zA-Z0-9]{16})(?:\\"|\')'
22
25
  )
26
+ # backward compat
23
27
  uid_pattern = re.compile(r'\.context\.uid\s*=\s*\\["\']([^"\']+)\\["\']')
24
28
  stem_uid_pattern = re.compile(
25
29
  r'\.transform\.stem_uid\s*=\s*\\["\']([^"\']+)\\["\']'
@@ -28,7 +32,9 @@ def parse_uid_from_code(
28
32
  r'\.transform\.version\s*=\s*\\["\']([^"\']+)\\["\']'
29
33
  )
30
34
  elif suffix in {".R", ".qmd", ".Rmd"}:
31
- track_pattern = re.compile(r'track\(\s*[\'"]([a-zA-Z0-9]{16})[\'"]')
35
+ track_pattern = re.compile(
36
+ r'track\(\s*(?:transform\s*=\s*)?([\'"])([a-zA-Z0-9]{16})\1'
37
+ )
32
38
  uid_pattern = None
33
39
  stem_uid_pattern = None
34
40
  version_pattern = None
@@ -40,7 +46,8 @@ def parse_uid_from_code(
40
46
 
41
47
  # Search for matches in the entire file content
42
48
  uid_match = track_pattern.search(content)
43
- uid = uid_match.group(1) if uid_match else None
49
+ group_index = 1 if suffix == ".ipynb" else 2
50
+ uid = uid_match.group(group_index) if uid_match else None
44
51
  stem_uid = None
45
52
  version = None
46
53
 
@@ -55,10 +62,9 @@ def parse_uid_from_code(
55
62
  version = version_match.group(1) if version_match else None
56
63
 
57
64
  if uid is None and (stem_uid is None or version is None):
58
- target = "script" if suffix == ".py" else "notebook"
65
+ target = "script" if suffix in {".py", ".R"} else "notebook"
59
66
  raise SystemExit(
60
- "Cannot infer transform uid."
61
- f"\nCall `ln.track()` and copy/paste the output into the {target}."
67
+ f"Cannot infer transform uid. Did you run `ln.track()` in your {target}?"
62
68
  )
63
69
 
64
70
  return uid, stem_uid, version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamin_cli
3
- Version: 0.21.1
3
+ Version: 0.21.2
4
4
  Summary: Lamin CLI.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Description-Content-Type: text/markdown
@@ -1,12 +1,12 @@
1
- lamin_cli/__init__.py,sha256=lljJkx69zUlYm79zTDbj6jGfXkWLw-knntxyv90iKYo,41
1
+ lamin_cli/__init__.py,sha256=D9ZqVWghrDM7UnzjFVK02QJtFo2-b1fIFi-UFzCy57o,41
2
2
  lamin_cli/__main__.py,sha256=-QAfgrYKcPjl0qkiWr8Tfm5wRaaZ99rW2atjIBnBn9Y,9900
3
3
  lamin_cli/_cache.py,sha256=kW8rqlMwQeOngm9uq2gjzPVl3EBrwh6W2F2AvyBFABY,799
4
4
  lamin_cli/_load.py,sha256=n0_qHTCXsZQIUy87rVdPvT89fx60N-KZgn_dL8nsvEA,5523
5
5
  lamin_cli/_migration.py,sha256=xTbad6aDUwuK0QvWCmDW3f8-xaqwisS-Cqf-LbD1WRI,1071
6
- lamin_cli/_save.py,sha256=eId1DYClPEt_pxccjzp6EYpevp3rIBRPXC3DETKPxOQ,6395
6
+ lamin_cli/_save.py,sha256=X5Rn1rmvtoKz10oZXWWDK3XmNchFhruQ_is-sE8Q-BM,6575
7
7
  lamin_cli/_settings.py,sha256=iS37mcQUHKRWxi2sHnAojEI6sWk3w232qwG-GeY2_Qc,1141
8
- lamin_cli-0.21.1.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
9
- lamin_cli-0.21.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
- lamin_cli-0.21.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
11
- lamin_cli-0.21.1.dist-info/METADATA,sha256=nv8TDrc0Oil2x5gTke8kteSRn4RbRJUe8R5yjGPt2O4,375
12
- lamin_cli-0.21.1.dist-info/RECORD,,
8
+ lamin_cli-0.21.2.dist-info/entry_points.txt,sha256=Qms85i9cZPlu-U7RnVZhFsF7vJ9gaLZUFkCjcGcXTpg,49
9
+ lamin_cli-0.21.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
10
+ lamin_cli-0.21.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
11
+ lamin_cli-0.21.2.dist-info/METADATA,sha256=sIANi10MCyiZTGXmC3Dip39i47q5hdPydeXhPL_-__s,375
12
+ lamin_cli-0.21.2.dist-info/RECORD,,