cycls 0.0.2.84__py3-none-any.whl → 0.0.2.86__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.
- cycls/app.py +1 -1
- cycls/function.py +9 -17
- cycls/web.py +8 -0
- {cycls-0.0.2.84.dist-info → cycls-0.0.2.86.dist-info}/METADATA +6 -4
- {cycls-0.0.2.84.dist-info → cycls-0.0.2.86.dist-info}/RECORD +7 -7
- {cycls-0.0.2.84.dist-info → cycls-0.0.2.86.dist-info}/WHEEL +0 -0
- {cycls-0.0.2.84.dist-info → cycls-0.0.2.86.dist-info}/entry_points.txt +0 -0
cycls/app.py
CHANGED
|
@@ -39,7 +39,7 @@ class App(Function):
|
|
|
39
39
|
super().__init__(
|
|
40
40
|
func=func,
|
|
41
41
|
name=name,
|
|
42
|
-
pip=["fastapi[standard]", "pyjwt", "cryptography", "uvicorn", "docker", *(pip or [])],
|
|
42
|
+
pip=["fastapi[standard]", "pyjwt", "cryptography", "uvicorn", "python-dotenv", "docker", *(pip or [])],
|
|
43
43
|
apt=apt,
|
|
44
44
|
copy=files,
|
|
45
45
|
base_url=_get_base_url(),
|
cycls/function.py
CHANGED
|
@@ -12,10 +12,6 @@ import tarfile
|
|
|
12
12
|
|
|
13
13
|
os.environ["DOCKER_BUILDKIT"] = "1"
|
|
14
14
|
|
|
15
|
-
BASE_IMAGE = "ghcr.io/cycls/base:python3.12"
|
|
16
|
-
BASE_PACKAGES = {"cloudpickle", "cryptography", "fastapi", "fastapi[standard]",
|
|
17
|
-
"pydantic", "pyjwt", "uvicorn", "uvicorn[standard]", "httpx"}
|
|
18
|
-
|
|
19
15
|
ENTRYPOINT_PY = '''import cloudpickle
|
|
20
16
|
with open("/app/function.pkl", "rb") as f:
|
|
21
17
|
func, args, kwargs = cloudpickle.load(f)
|
|
@@ -84,22 +80,17 @@ class Function:
|
|
|
84
80
|
"""Executes functions in Docker containers."""
|
|
85
81
|
|
|
86
82
|
def __init__(self, func, name, python_version=None, pip=None, apt=None,
|
|
87
|
-
run_commands=None, copy=None, base_url=None, api_key=None
|
|
83
|
+
run_commands=None, copy=None, base_url=None, api_key=None):
|
|
88
84
|
self.func = func
|
|
89
85
|
self.name = name.replace('_', '-')
|
|
90
86
|
self.python_version = python_version or f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
87
|
+
self.base_image = f"python:{self.python_version}-slim"
|
|
91
88
|
self.apt = sorted(apt or [])
|
|
92
89
|
self.run_commands = sorted(run_commands or [])
|
|
93
90
|
self.copy = {f: f for f in copy} if isinstance(copy, list) else (copy or {})
|
|
94
|
-
self.base_image = base_image or BASE_IMAGE
|
|
95
91
|
self.base_url = base_url or "https://service-core-280879789566.me-central1.run.app"
|
|
96
92
|
self.api_key = api_key
|
|
97
|
-
|
|
98
|
-
user_packages = set(pip or [])
|
|
99
|
-
if self.base_image == BASE_IMAGE:
|
|
100
|
-
self.pip = sorted(user_packages - BASE_PACKAGES)
|
|
101
|
-
else:
|
|
102
|
-
self.pip = sorted(user_packages | {"cloudpickle"})
|
|
93
|
+
self.pip = sorted(set(pip or []) | {"cloudpickle"})
|
|
103
94
|
|
|
104
95
|
self.image_prefix = f"cycls/{self.name}"
|
|
105
96
|
self.managed_label = "cycls.function"
|
|
@@ -151,11 +142,12 @@ class Function:
|
|
|
151
142
|
return f"{self.image_prefix}:{hashlib.sha256(''.join(parts).encode()).hexdigest()[:16]}"
|
|
152
143
|
|
|
153
144
|
def _dockerfile_preamble(self) -> str:
|
|
154
|
-
lines = [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
lines = [
|
|
146
|
+
f"FROM {self.base_image}",
|
|
147
|
+
"ENV PIP_ROOT_USER_ACTION=ignore PYTHONUNBUFFERED=1",
|
|
148
|
+
"WORKDIR /app",
|
|
149
|
+
"RUN pip install uv",
|
|
150
|
+
]
|
|
159
151
|
|
|
160
152
|
if self.apt:
|
|
161
153
|
lines.append(f"RUN apt-get update && apt-get install -y --no-install-recommends {' '.join(self.apt)}")
|
cycls/web.py
CHANGED
|
@@ -90,6 +90,12 @@ def web(func, config):
|
|
|
90
90
|
messages: Any
|
|
91
91
|
user: Optional[User] = None
|
|
92
92
|
|
|
93
|
+
@property
|
|
94
|
+
def last_message(self) -> str:
|
|
95
|
+
if self.messages:
|
|
96
|
+
return self.messages[-1].get("content", "")
|
|
97
|
+
return ""
|
|
98
|
+
|
|
93
99
|
app = FastAPI()
|
|
94
100
|
bearer_scheme = HTTPBearer()
|
|
95
101
|
|
|
@@ -134,6 +140,8 @@ def web(func, config):
|
|
|
134
140
|
|
|
135
141
|
def serve(func, config, name, port):
|
|
136
142
|
import uvicorn, logging
|
|
143
|
+
from dotenv import load_dotenv
|
|
144
|
+
load_dotenv()
|
|
137
145
|
if isinstance(config, dict):
|
|
138
146
|
config = Config(**config)
|
|
139
147
|
logging.getLogger("uvicorn.error").addFilter(lambda r: "0.0.0.0" not in r.getMessage())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cycls
|
|
3
|
-
Version: 0.0.2.
|
|
3
|
+
Version: 0.0.2.86
|
|
4
4
|
Summary: Distribute Intelligence
|
|
5
5
|
Author: Mohammed J. AlRujayi
|
|
6
6
|
Author-email: mj@cycls.com
|
|
@@ -43,9 +43,11 @@ Distribute Intelligence
|
|
|
43
43
|
|
|
44
44
|
The open-source SDK for distributing AI agents.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
```
|
|
47
|
+
Agent extends App (prompts, skills)
|
|
48
|
+
└── App extends Function (web UI)
|
|
49
|
+
└── Function (containerization)
|
|
50
|
+
```
|
|
49
51
|
|
|
50
52
|
## Distribute Intelligence
|
|
51
53
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
cycls/__init__.py,sha256=efbq0vRijGOByKtz9bRF8WQFYmnPSgZV1DH-54s6iwQ,493
|
|
2
|
-
cycls/app.py,sha256=
|
|
2
|
+
cycls/app.py,sha256=cYzHJboFRAKXhImJOkTLdMxpFZFlkVt_oulJrhF14KU,3124
|
|
3
3
|
cycls/auth.py,sha256=xkndHZyCfnlertMMEKerCJjf23N3fVcTRVTTSXTTuzg,247
|
|
4
4
|
cycls/cli.py,sha256=cVbIkTDnVofohvByyYUrXF_RYDQZVQECJqo7cPBPJfs,4781
|
|
5
|
-
cycls/function.py,sha256=
|
|
5
|
+
cycls/function.py,sha256=8V5lR57bv-AHNElTyx_O3_m3F7V4jRaX3iNqkkrdJ9M,14738
|
|
6
6
|
cycls/themes/default/assets/index-C2r4Daz3.js,sha256=OGzjspxo0uUTdtQIzWZNgFMhGUtW4wSVuW33iA7oLFM,1351283
|
|
7
7
|
cycls/themes/default/assets/index-DWGS8zpa.css,sha256=SxylXQV1qgQ0sw9QlMxcu9jwWTu8XPOnWZju8upUpCM,6504
|
|
8
8
|
cycls/themes/default/index.html,sha256=WPUqVzJyh-aO2ulWTbXwOVAfWHaj0yWTGd9e8HOEro4,828
|
|
9
9
|
cycls/themes/dev/index.html,sha256=QJBHkdNuMMiwQU7o8dN8__8YQeQB45D37D-NCXIWB2Q,11585
|
|
10
|
-
cycls/web.py,sha256=
|
|
11
|
-
cycls-0.0.2.
|
|
12
|
-
cycls-0.0.2.
|
|
13
|
-
cycls-0.0.2.
|
|
14
|
-
cycls-0.0.2.
|
|
10
|
+
cycls/web.py,sha256=svDytrmrUoeZQtl9lBb9pGLb1JRKtcB8nZmHnErrweA,5540
|
|
11
|
+
cycls-0.0.2.86.dist-info/METADATA,sha256=ghstlsGG-TgXZlStTfBuVcH9cpB4Lgf7yJ4JQz6hmzE,8453
|
|
12
|
+
cycls-0.0.2.86.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
13
|
+
cycls-0.0.2.86.dist-info/entry_points.txt,sha256=vEhqUxFhhuzCKWtq02LbMnT3wpUqdfgcM3Yh-jjXom8,40
|
|
14
|
+
cycls-0.0.2.86.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|