nebu 0.1.53__py3-none-any.whl → 0.1.56__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.
- nebu/config.py +13 -6
- nebu/processors/decorate.py +2 -2
- nebu/processors/processor.py +14 -5
- {nebu-0.1.53.dist-info → nebu-0.1.56.dist-info}/METADATA +1 -1
- {nebu-0.1.53.dist-info → nebu-0.1.56.dist-info}/RECORD +8 -8
- {nebu-0.1.53.dist-info → nebu-0.1.56.dist-info}/WHEEL +0 -0
- {nebu-0.1.53.dist-info → nebu-0.1.56.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.53.dist-info → nebu-0.1.56.dist-info}/top_level.txt +0 -0
nebu/config.py
CHANGED
@@ -52,12 +52,17 @@ class GlobalConfig:
|
|
52
52
|
config = cls() # default
|
53
53
|
|
54
54
|
# Collect environment variables (no fallback defaults here)
|
55
|
-
env_api_key =
|
56
|
-
"
|
55
|
+
env_api_key = (
|
56
|
+
os.environ.get("NEBU_API_KEY")
|
57
|
+
or os.environ.get("AGENTSEA_API_KEY")
|
58
|
+
or os.environ.get("ORIGN_API_KEY")
|
57
59
|
)
|
58
|
-
env_server = os.environ.get("NEBU_SERVER")
|
59
|
-
env_auth_server =
|
60
|
-
"
|
60
|
+
env_server = os.environ.get("NEBU_SERVER")
|
61
|
+
env_auth_server = (
|
62
|
+
os.environ.get("NEBU_AUTH_SERVER")
|
63
|
+
or os.environ.get("AGENTSEA_AUTH_SERVER")
|
64
|
+
or os.environ.get("ORIGN_AUTH_SERVER")
|
65
|
+
or os.environ.get("AGENTSEA_AUTH_URL")
|
61
66
|
)
|
62
67
|
|
63
68
|
# Only proceed if all three environment variables are present
|
@@ -158,7 +163,9 @@ class ContainerConfig:
|
|
158
163
|
Load configuration from environment variables.
|
159
164
|
"""
|
160
165
|
return cls(
|
161
|
-
api_key=os.environ.get("NEBU_API_KEY")
|
166
|
+
api_key=os.environ.get("NEBU_API_KEY")
|
167
|
+
or os.environ.get("AGENTSEA_API_KEY")
|
168
|
+
or os.environ.get("ORIGN_API_KEY"),
|
162
169
|
server=os.environ.get("NEBU_SERVER"),
|
163
170
|
namespace=os.environ.get("NEBU_NAMESPACE"),
|
164
171
|
name=os.environ.get("NEBU_NAME"),
|
nebu/processors/decorate.py
CHANGED
@@ -396,13 +396,13 @@ def processor(
|
|
396
396
|
):
|
397
397
|
def decorator(
|
398
398
|
func: Callable[[Any], Any],
|
399
|
-
) -> Processor
|
399
|
+
) -> Processor:
|
400
400
|
# --- Prevent Recursion Guard ---
|
401
401
|
if os.environ.get(_NEBU_INSIDE_CONSUMER_ENV_VAR) == "1":
|
402
402
|
print(
|
403
403
|
f"[DEBUG Decorator] Guard triggered for '{func.__name__}'. Returning original function."
|
404
404
|
)
|
405
|
-
return func
|
405
|
+
return func # type: ignore
|
406
406
|
# --- End Guard ---
|
407
407
|
|
408
408
|
print(
|
nebu/processors/processor.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import json
|
2
2
|
import threading
|
3
|
-
from typing import Any, Dict, List, Optional
|
3
|
+
from typing import Any, Dict, Generic, List, Optional, TypeVar
|
4
4
|
|
5
5
|
import requests
|
6
6
|
from pydantic import BaseModel
|
@@ -19,6 +19,8 @@ from nebu.processors.models import (
|
|
19
19
|
V1UpdateProcessor,
|
20
20
|
)
|
21
21
|
|
22
|
+
InputType = TypeVar("InputType", bound=BaseModel)
|
23
|
+
|
22
24
|
|
23
25
|
def _fetch_and_print_logs(log_url: str, api_key: str, processor_name: str):
|
24
26
|
"""Helper function to fetch logs in a separate thread."""
|
@@ -78,7 +80,7 @@ def _fetch_and_print_logs(log_url: str, api_key: str, processor_name: str):
|
|
78
80
|
)
|
79
81
|
|
80
82
|
|
81
|
-
class Processor:
|
83
|
+
class Processor(Generic[InputType]):
|
82
84
|
"""
|
83
85
|
A class for managing Processor instances.
|
84
86
|
"""
|
@@ -203,14 +205,18 @@ class Processor:
|
|
203
205
|
patch_response.raise_for_status()
|
204
206
|
print(f"Updated Processor {self.processor.metadata.name}")
|
205
207
|
|
206
|
-
def __call__(self, data:
|
208
|
+
def __call__(self, data: InputType, wait: bool = False) -> Dict[str, Any]:
|
207
209
|
"""
|
208
210
|
Allows the Processor instance to be called like a function, sending data.
|
209
211
|
"""
|
210
212
|
return self.send(data=data, wait=wait)
|
211
213
|
|
212
214
|
def send(
|
213
|
-
self,
|
215
|
+
self,
|
216
|
+
data: InputType,
|
217
|
+
wait: bool = False,
|
218
|
+
logs: bool = False,
|
219
|
+
api_key: Optional[str] = None,
|
214
220
|
) -> Dict[str, Any]:
|
215
221
|
"""
|
216
222
|
Send data to the processor and optionally stream logs in the background.
|
@@ -225,6 +231,9 @@ class Processor:
|
|
225
231
|
processor_name = self.processor.metadata.name
|
226
232
|
processor_namespace = self.processor.metadata.namespace
|
227
233
|
|
234
|
+
if not api_key:
|
235
|
+
api_key = self.api_key
|
236
|
+
|
228
237
|
# --- Send Data ---
|
229
238
|
messages_url = (
|
230
239
|
f"{self.processors_url}/{processor_namespace}/{processor_name}/messages"
|
@@ -236,7 +245,7 @@ class Processor:
|
|
236
245
|
response = requests.post(
|
237
246
|
messages_url,
|
238
247
|
json=stream_data.model_dump(mode="json", exclude_none=True),
|
239
|
-
headers={"Authorization": f"Bearer {
|
248
|
+
headers={"Authorization": f"Bearer {api_key}"},
|
240
249
|
)
|
241
250
|
response.raise_for_status()
|
242
251
|
send_response_json = response.json()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
nebu/__init__.py,sha256=gJ49VnAs4GC_bUV90j-SS-iiYWESuCf4uuE7mx4T78k,385
|
2
2
|
nebu/auth.py,sha256=N_v6SPFD9HU_UoRDTaouH03g2Hmo9C-xxqInE1FweXE,1471
|
3
3
|
nebu/cache.py,sha256=jmluqvWnE9N8uNq6nppXSxEJK7DKWaB79GicaGg9KmY,4718
|
4
|
-
nebu/config.py,sha256=
|
4
|
+
nebu/config.py,sha256=ZHLVKASiMHesWdRPBJOEfVgdsdQuLS9nieaWt7tkAbQ,6006
|
5
5
|
nebu/data.py,sha256=yAQ5EXmdwsQfaFC30DB8IrzKNS53NhUkPrwKyM5nbxA,39782
|
6
6
|
nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
|
7
7
|
nebu/builders/builder.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -11,15 +11,15 @@ nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,
|
|
11
11
|
nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
|
12
12
|
nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
|
13
13
|
nebu/processors/consumer.py,sha256=q4cFKPEfMf1xIs0Y3CjUDCR35QVjr0F_hSOZUKUYc_U,33667
|
14
|
-
nebu/processors/decorate.py,sha256=
|
14
|
+
nebu/processors/decorate.py,sha256=f4y0BL2W07XMMVzm0GPwh7GfJ-QRioSjBofJSa7hQtg,53175
|
15
15
|
nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
|
16
16
|
nebu/processors/models.py,sha256=y40HoW-MEzDWB2dm_tsYlUy3Nf3s6eiLC0iGO9BoNog,3956
|
17
|
-
nebu/processors/processor.py,sha256=
|
17
|
+
nebu/processors/processor.py,sha256=1iFR5JEOYrUpljSJtRzNKFpmUyZU-KWb_dJQDE9IEPs,15613
|
18
18
|
nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
|
19
19
|
nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
|
20
20
|
nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
-
nebu-0.1.
|
22
|
-
nebu-0.1.
|
23
|
-
nebu-0.1.
|
24
|
-
nebu-0.1.
|
25
|
-
nebu-0.1.
|
21
|
+
nebu-0.1.56.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
22
|
+
nebu-0.1.56.dist-info/METADATA,sha256=k1ZNw6tIK0LLhliNmgcqNjRKz_BQZyuRkY6SfjIt5PY,1731
|
23
|
+
nebu-0.1.56.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
24
|
+
nebu-0.1.56.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
|
25
|
+
nebu-0.1.56.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|