kalibr 1.0.16__py3-none-any.whl → 1.0.17__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.
- kalibr/kalibr_app.py +24 -57
- {kalibr-1.0.16.dist-info → kalibr-1.0.17.dist-info}/METADATA +1 -1
- kalibr-1.0.17.dist-info/RECORD +10 -0
- kalibr-1.0.16.dist-info/RECORD +0 -10
- {kalibr-1.0.16.dist-info → kalibr-1.0.17.dist-info}/WHEEL +0 -0
- {kalibr-1.0.16.dist-info → kalibr-1.0.17.dist-info}/entry_points.txt +0 -0
- {kalibr-1.0.16.dist-info → kalibr-1.0.17.dist-info}/licenses/LICENSE.txt +0 -0
- {kalibr-1.0.16.dist-info → kalibr-1.0.17.dist-info}/top_level.txt +0 -0
kalibr/kalibr_app.py
CHANGED
|
@@ -1,71 +1,38 @@
|
|
|
1
|
+
import importlib.util
|
|
1
2
|
import os
|
|
2
|
-
import sys
|
|
3
|
-
import typer
|
|
4
3
|
import uvicorn
|
|
5
|
-
import importlib.util
|
|
6
4
|
from fastapi import FastAPI
|
|
7
|
-
from rich.console import Console
|
|
8
|
-
|
|
9
|
-
console = Console()
|
|
10
|
-
|
|
11
5
|
|
|
12
6
|
class KalibrApp(FastAPI):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
self.get(f"/{func.__name__}")(func)
|
|
17
|
-
return func
|
|
18
|
-
return decorator
|
|
7
|
+
def __init__(self):
|
|
8
|
+
super().__init__()
|
|
9
|
+
print("🚀 KalibrApp initialized. Ready to serve AI tools.")
|
|
19
10
|
|
|
11
|
+
def run(self, host="127.0.0.1", port=8000):
|
|
12
|
+
print(f"🚀 Starting Kalibr server on http://{host}:{port}")
|
|
13
|
+
uvicorn.run(self, host=host, port=port)
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
# --- CLI helper functions ---
|
|
22
16
|
|
|
17
|
+
def serve_app(file_path: str):
|
|
18
|
+
"""Run a Kalibr app file (e.g. demo_app.py) locally."""
|
|
19
|
+
if not os.path.exists(file_path):
|
|
20
|
+
print(f"❌ File not found: {file_path}")
|
|
21
|
+
return
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if not os.path.exists(abs_path):
|
|
27
|
-
raise FileNotFoundError(f"File not found: {abs_path}")
|
|
28
|
-
|
|
29
|
-
spec = importlib.util.spec_from_file_location("user_app", abs_path)
|
|
23
|
+
module_name = os.path.splitext(os.path.basename(file_path))[0]
|
|
24
|
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
|
30
25
|
module = importlib.util.module_from_spec(spec)
|
|
31
|
-
sys.modules["user_app"] = module
|
|
32
26
|
spec.loader.exec_module(module)
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@app.command("serve")
|
|
40
|
-
def serve(file: str):
|
|
41
|
-
"""Run a Kalibr app locally from a .py file."""
|
|
42
|
-
console.print(f"[cyan]🚀 Serving {file} locally...[/cyan]")
|
|
43
|
-
try:
|
|
44
|
-
app_instance = load_app_from_file(file)
|
|
45
|
-
console.print("[green]✅ App loaded successfully. Starting server...[/green]")
|
|
46
|
-
uvicorn.run(app_instance, host="127.0.0.1", port=8000, reload=False)
|
|
47
|
-
except Exception as e:
|
|
48
|
-
console.print(f"[red]❌ Failed to start app:[/red] {e}")
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@app.command("deploy")
|
|
52
|
-
def deploy(file: str):
|
|
53
|
-
console.print(f"[yellow]🚀 Deploying {file} (stub)...[/yellow]")
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@app.command("usage")
|
|
57
|
-
def usage():
|
|
58
|
-
console.print(
|
|
59
|
-
"\n[bold cyan]Kalibr Connect Commands:[/bold cyan]\n"
|
|
60
|
-
" kalibr-connect serve <file> Run a Kalibr app locally.\n"
|
|
61
|
-
" kalibr-connect deploy <file> Deploy your Kalibr app.\n"
|
|
62
|
-
" kalibr-connect usage Show this usage guide.\n"
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def run():
|
|
67
|
-
app()
|
|
28
|
+
app = getattr(module, "app", None)
|
|
29
|
+
if not app:
|
|
30
|
+
print("❌ No `app` instance found in the provided file.")
|
|
31
|
+
return
|
|
68
32
|
|
|
33
|
+
print(f"🚀 Serving {file_path} locally...")
|
|
34
|
+
uvicorn.run(app, host="127.0.0.1", port=8000)
|
|
69
35
|
|
|
70
|
-
|
|
71
|
-
|
|
36
|
+
def deploy_app(file_path: str):
|
|
37
|
+
"""Stub for future deploy command."""
|
|
38
|
+
print(f"🚀 Deploying {file_path} (stub). Future versions will handle cloud deploys.")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
kalibr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
kalibr/__main__.py,sha256=oSEVIA6G1F6DVJjq4hcV_cX1_RYJkIJjdC4yc0HzTpI,693
|
|
3
|
+
kalibr/kalibr_app.py,sha256=UX80reWShHXkHiDu8HgNAzoR3NBIE1YEiYWs1azahn4,1252
|
|
4
|
+
kalibr/schema_generators.py,sha256=1CFc0mCI0KVM48gEeGKK91I42WYyPYfEk2Yx2uZh478,286
|
|
5
|
+
kalibr-1.0.17.dist-info/licenses/LICENSE.txt,sha256=1WLJDkrueNpHCROy9zANrK2Ar2weqZ_z88hw90UKDoc,451
|
|
6
|
+
kalibr-1.0.17.dist-info/METADATA,sha256=cBJH3QYbOumvh0OKX-monN17-qIxSVYuH8o4yW85rUw,2632
|
|
7
|
+
kalibr-1.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
kalibr-1.0.17.dist-info/entry_points.txt,sha256=T-DOrFEZb0fZxA9H8sSCh-2zKxdjnmpzIRmm5TY_f6s,56
|
|
9
|
+
kalibr-1.0.17.dist-info/top_level.txt,sha256=OkloC5_IfpE4-QwI30aLIYbFZk_-ChABWF7aBGddy28,7
|
|
10
|
+
kalibr-1.0.17.dist-info/RECORD,,
|
kalibr-1.0.16.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
kalibr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
kalibr/__main__.py,sha256=oSEVIA6G1F6DVJjq4hcV_cX1_RYJkIJjdC4yc0HzTpI,693
|
|
3
|
-
kalibr/kalibr_app.py,sha256=pqzsPaZbAAe9aBJ-bfJBfce-wZgaFj7iVKz7Nz823S4,1953
|
|
4
|
-
kalibr/schema_generators.py,sha256=1CFc0mCI0KVM48gEeGKK91I42WYyPYfEk2Yx2uZh478,286
|
|
5
|
-
kalibr-1.0.16.dist-info/licenses/LICENSE.txt,sha256=1WLJDkrueNpHCROy9zANrK2Ar2weqZ_z88hw90UKDoc,451
|
|
6
|
-
kalibr-1.0.16.dist-info/METADATA,sha256=7qrQz66EIqZjkCEepTIDqY5bWMJ6AAg31dH5qMJZ1qY,2632
|
|
7
|
-
kalibr-1.0.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
kalibr-1.0.16.dist-info/entry_points.txt,sha256=T-DOrFEZb0fZxA9H8sSCh-2zKxdjnmpzIRmm5TY_f6s,56
|
|
9
|
-
kalibr-1.0.16.dist-info/top_level.txt,sha256=OkloC5_IfpE4-QwI30aLIYbFZk_-ChABWF7aBGddy28,7
|
|
10
|
-
kalibr-1.0.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|