lmnr 0.2.11__py3-none-any.whl → 0.2.13__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.
lmnr/cli/cli.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from pathlib import Path
2
+ import sys
2
3
  import requests
3
4
  from dotenv import load_dotenv
4
5
  import os
@@ -8,6 +9,8 @@ from cookiecutter.main import cookiecutter
8
9
  from pydantic.alias_generators import to_pascal
9
10
 
10
11
  from lmnr.cli.zip import zip_directory
12
+ from lmnr.sdk.registry import Registry as Pipeline
13
+ from lmnr.sdk.remote_debugger import RemoteDebugger
11
14
 
12
15
  from .parser.parser import runnable_graph_to_template_vars
13
16
 
@@ -134,3 +137,43 @@ def deploy(endpoint_id, project_api_key):
134
137
  logging.exception("Error in deploying code")
135
138
  finally:
136
139
  Path.unlink(zip_file_path, missing_ok=True)
140
+
141
+
142
+ @cli.command(name="dev")
143
+ @click.option(
144
+ "-p",
145
+ "--project-api-key",
146
+ help="Project API key",
147
+ )
148
+ def dev(project_api_key):
149
+ project_api_key = project_api_key or os.environ.get("LMNR_PROJECT_API_KEY")
150
+ if not project_api_key:
151
+ load_dotenv()
152
+ project_api_key = os.environ.get("LMNR_PROJECT_API_KEY")
153
+ if not project_api_key:
154
+ raise ValueError("LMNR_PROJECT_API_KEY is not set")
155
+
156
+ cur_dir = os.getcwd() # e.g. /Users/username/project_name
157
+ parent_dir, name = os.path.split(cur_dir) # e.g. /Users/username, project_name
158
+
159
+ # Needed to __import__ pipeline.py
160
+ if sys.path[0] != parent_dir:
161
+ sys.path.insert(0, parent_dir)
162
+ # Needed to import src in pipeline.py and other files
163
+ if cur_dir not in sys.path:
164
+ sys.path.insert(0, cur_dir)
165
+
166
+ module_name = f"{name}.pipeline"
167
+ __import__(module_name)
168
+ module = sys.modules[module_name]
169
+
170
+ matches = [v for v in module.__dict__.values() if isinstance(v, Pipeline)]
171
+ if not matches:
172
+ raise ValueError("No Pipeline found in the module")
173
+ if len(matches) > 1:
174
+ raise ValueError("Multiple Pipelines found in the module")
175
+ pipeline = matches[0]
176
+
177
+ tools = pipeline.functions
178
+ debugger = RemoteDebugger(project_api_key, tools)
179
+ debugger.start()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lmnr
3
- Version: 0.2.11
3
+ Version: 0.2.13
4
4
  Summary: Python SDK for Laminar AI
5
5
  License: Apache-2.0
6
6
  Author: lmnr.ai
@@ -1,7 +1,7 @@
1
1
  lmnr/__init__.py,sha256=BBJ87AiHC_OpaYOCzF8QSsf7eO3LlJPOCBXHNKurbE4,235
2
2
  lmnr/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  lmnr/cli/__main__.py,sha256=8hDtWlaFZK24KhfNq_ZKgtXqYHsDQDetukOCMlsbW0Q,59
4
- lmnr/cli/cli.py,sha256=qG3-aY2EJIW3BSD-_s1vUsxHcxC9kiuIeAO8aVUq3ik,4103
4
+ lmnr/cli/cli.py,sha256=6xmIxRAMx7th0S9rfkzUeWyt-oWaiwPWk4YeVzXhElQ,5509
5
5
  lmnr/cli/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  lmnr/cli/parser/nodes/__init__.py,sha256=2MkPdKulb1kuNe6aT71CaqBA8iBrXyb5pq5bu_EvCb8,1052
7
7
  lmnr/cli/parser/nodes/code.py,sha256=8lTPBibUzaw_t-9QoPljhxH3KA4CLn9DJjA-iWpprOA,933
@@ -21,8 +21,8 @@ lmnr/sdk/endpoint.py,sha256=0HjcxMUcJz-klFZO2f5xtTaoLjcaEb8vrJ_YldTWUc8,7467
21
21
  lmnr/sdk/registry.py,sha256=sEYQFOjO72YvgBSEkBrvoewFExoyBzx6nELgBarvD6Y,755
22
22
  lmnr/sdk/remote_debugger.py,sha256=BYAN13KUDxH412qD3HXdDH0RfokrePquDt35fzB7GUg,5010
23
23
  lmnr/types.py,sha256=3HpLBQZr6F5YMISHYLnzzyrTwUttNqJxpyobw31YYJQ,2347
24
- lmnr-0.2.11.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
25
- lmnr-0.2.11.dist-info/METADATA,sha256=Vy8sFZj2301oMMAdDWMnqa23iWBSzBuy68WhEgvlVZU,5565
26
- lmnr-0.2.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
27
- lmnr-0.2.11.dist-info/entry_points.txt,sha256=Qg7ZRax4k-rcQsZ26XRYQ8YFSBiyY2PNxYfq4a6PYXI,41
28
- lmnr-0.2.11.dist-info/RECORD,,
24
+ lmnr-0.2.13.dist-info/LICENSE,sha256=67b_wJHVV1CBaWkrKFWU1wyqTPSdzH77Ls-59631COg,10411
25
+ lmnr-0.2.13.dist-info/METADATA,sha256=G0wy4T7F8TlHpFXky86Bq5hV3nt1VNZ6hf9XUVbraew,5565
26
+ lmnr-0.2.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
27
+ lmnr-0.2.13.dist-info/entry_points.txt,sha256=Qg7ZRax4k-rcQsZ26XRYQ8YFSBiyY2PNxYfq4a6PYXI,41
28
+ lmnr-0.2.13.dist-info/RECORD,,
File without changes
File without changes