kalibr 1.0.15__tar.gz → 1.0.17__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.
- {kalibr-1.0.15/kalibr.egg-info → kalibr-1.0.17}/PKG-INFO +1 -1
- kalibr-1.0.17/kalibr/__main__.py +31 -0
- kalibr-1.0.17/kalibr/kalibr_app.py +38 -0
- {kalibr-1.0.15 → kalibr-1.0.17/kalibr.egg-info}/PKG-INFO +1 -1
- {kalibr-1.0.15 → kalibr-1.0.17}/pyproject.toml +1 -1
- {kalibr-1.0.15 → kalibr-1.0.17}/setup.py +1 -1
- kalibr-1.0.15/kalibr/__main__.py +0 -4
- kalibr-1.0.15/kalibr/kalibr_app.py +0 -71
- {kalibr-1.0.15 → kalibr-1.0.17}/KALIBR_SDK_COMPLETE.md +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/LICENSE.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/MANIFEST.in +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/README.md +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/examples/__init__.py +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/examples/demo_app.py +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/examples/enhanced_kalibr_example.py +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr/__init__.py +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr/schema_generators.py +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr.egg-info/SOURCES.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr.egg-info/dependency_links.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr.egg-info/entry_points.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr.egg-info/requires.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/kalibr.egg-info/top_level.txt +0 -0
- {kalibr-1.0.15 → kalibr-1.0.17}/setup.cfg +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from kalibr.kalibr_app import serve_app, deploy_app
|
|
3
|
+
|
|
4
|
+
cli = typer.Typer(help="Kalibr Connect CLI")
|
|
5
|
+
|
|
6
|
+
@cli.command("serve")
|
|
7
|
+
def serve(file: str):
|
|
8
|
+
"""Run a Kalibr app locally."""
|
|
9
|
+
serve_app(file)
|
|
10
|
+
|
|
11
|
+
@cli.command("deploy")
|
|
12
|
+
def deploy(file: str):
|
|
13
|
+
"""Deploy a Kalibr app."""
|
|
14
|
+
deploy_app(file)
|
|
15
|
+
|
|
16
|
+
@cli.command("usage")
|
|
17
|
+
def usage():
|
|
18
|
+
"""Show usage guide."""
|
|
19
|
+
print("""
|
|
20
|
+
Kalibr Connect Commands:
|
|
21
|
+
kalibr-connect serve <file> Run a Kalibr app locally.
|
|
22
|
+
kalibr-connect deploy <file> Deploy your Kalibr app.
|
|
23
|
+
kalibr-connect usage Show this usage guide.
|
|
24
|
+
""")
|
|
25
|
+
|
|
26
|
+
def main():
|
|
27
|
+
"""Entry point for console_scripts."""
|
|
28
|
+
cli()
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import os
|
|
3
|
+
import uvicorn
|
|
4
|
+
from fastapi import FastAPI
|
|
5
|
+
|
|
6
|
+
class KalibrApp(FastAPI):
|
|
7
|
+
def __init__(self):
|
|
8
|
+
super().__init__()
|
|
9
|
+
print("🚀 KalibrApp initialized. Ready to serve AI tools.")
|
|
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)
|
|
14
|
+
|
|
15
|
+
# --- CLI helper functions ---
|
|
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
|
|
22
|
+
|
|
23
|
+
module_name = os.path.splitext(os.path.basename(file_path))[0]
|
|
24
|
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
|
25
|
+
module = importlib.util.module_from_spec(spec)
|
|
26
|
+
spec.loader.exec_module(module)
|
|
27
|
+
|
|
28
|
+
app = getattr(module, "app", None)
|
|
29
|
+
if not app:
|
|
30
|
+
print("❌ No `app` instance found in the provided file.")
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
print(f"🚀 Serving {file_path} locally...")
|
|
34
|
+
uvicorn.run(app, host="127.0.0.1", port=8000)
|
|
35
|
+
|
|
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.")
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "kalibr"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.17"
|
|
8
8
|
description = "Kalibr SDK — Integrate your SaaS with every major AI model using a single SDK."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Devon" }]
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="kalibr",
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.17", # bump for new upload
|
|
6
6
|
author="Devon",
|
|
7
7
|
author_email="hello@kalibr.systems",
|
|
8
8
|
description="Kalibr SDK — integrate your SaaS or app with every major AI model using one schema.",
|
kalibr-1.0.15/kalibr/__main__.py
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
import typer
|
|
4
|
-
import uvicorn
|
|
5
|
-
import importlib.util
|
|
6
|
-
from fastapi import FastAPI
|
|
7
|
-
from rich.console import Console
|
|
8
|
-
|
|
9
|
-
console = Console()
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class KalibrApp(FastAPI):
|
|
13
|
-
"""Lightweight FastAPI wrapper with a .tool() decorator."""
|
|
14
|
-
def tool(self):
|
|
15
|
-
def decorator(func):
|
|
16
|
-
self.get(f"/{func.__name__}")(func)
|
|
17
|
-
return func
|
|
18
|
-
return decorator
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
app = typer.Typer(help="Kalibr Connect CLI")
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def load_app_from_file(file_path: str):
|
|
25
|
-
abs_path = os.path.abspath(file_path)
|
|
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)
|
|
30
|
-
module = importlib.util.module_from_spec(spec)
|
|
31
|
-
sys.modules["user_app"] = module
|
|
32
|
-
spec.loader.exec_module(module)
|
|
33
|
-
|
|
34
|
-
if not hasattr(module, "app"):
|
|
35
|
-
raise AttributeError("No FastAPI app instance named 'app' found in the file.")
|
|
36
|
-
return module.app
|
|
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()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if __name__ == "__main__":
|
|
71
|
-
run()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|