nebu 0.1.53__tar.gz → 0.1.56__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.
Files changed (31) hide show
  1. {nebu-0.1.53/src/nebu.egg-info → nebu-0.1.56}/PKG-INFO +1 -1
  2. {nebu-0.1.53 → nebu-0.1.56}/pyproject.toml +1 -1
  3. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/config.py +13 -6
  4. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/decorate.py +2 -2
  5. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/processor.py +14 -5
  6. {nebu-0.1.53 → nebu-0.1.56/src/nebu.egg-info}/PKG-INFO +1 -1
  7. {nebu-0.1.53 → nebu-0.1.56}/LICENSE +0 -0
  8. {nebu-0.1.53 → nebu-0.1.56}/README.md +0 -0
  9. {nebu-0.1.53 → nebu-0.1.56}/setup.cfg +0 -0
  10. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/__init__.py +0 -0
  11. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/auth.py +0 -0
  12. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/builders/builder.py +0 -0
  13. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/builders/models.py +0 -0
  14. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/cache.py +0 -0
  15. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/containers/container.py +0 -0
  16. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/containers/decorator.py +0 -0
  17. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/containers/models.py +0 -0
  18. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/containers/server.py +0 -0
  19. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/data.py +0 -0
  20. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/meta.py +0 -0
  21. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/consumer.py +0 -0
  22. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/default.py +0 -0
  23. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/models.py +0 -0
  24. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/processors/remote.py +0 -0
  25. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/redis/models.py +0 -0
  26. {nebu-0.1.53 → nebu-0.1.56}/src/nebu/services/service.py +0 -0
  27. {nebu-0.1.53 → nebu-0.1.56}/src/nebu.egg-info/SOURCES.txt +0 -0
  28. {nebu-0.1.53 → nebu-0.1.56}/src/nebu.egg-info/dependency_links.txt +0 -0
  29. {nebu-0.1.53 → nebu-0.1.56}/src/nebu.egg-info/requires.txt +0 -0
  30. {nebu-0.1.53 → nebu-0.1.56}/src/nebu.egg-info/top_level.txt +0 -0
  31. {nebu-0.1.53 → nebu-0.1.56}/tests/test_containers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.53
3
+ Version: 0.1.56
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nebu"
3
- version = "0.1.53"
3
+ version = "0.1.56"
4
4
  description = "A globally distributed container runtime"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10.14"
@@ -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 = os.environ.get("NEBU_API_KEY") or os.environ.get(
56
- "AGENTSEA_API_KEY"
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") or os.environ.get("AGENTSEA_SERVER")
59
- env_auth_server = os.environ.get("NEBU_AUTH_SERVER") or os.environ.get(
60
- "AGENTSEA_AUTH_SERVER"
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"),
@@ -396,13 +396,13 @@ def processor(
396
396
  ):
397
397
  def decorator(
398
398
  func: Callable[[Any], Any],
399
- ) -> Processor | Callable[[Any], Any]:
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(
@@ -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: BaseModel, wait: bool = False) -> Dict[str, Any]:
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, data: BaseModel, wait: bool = False, logs: bool = False
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 {self.api_key}"},
248
+ headers={"Authorization": f"Bearer {api_key}"},
240
249
  )
241
250
  response.raise_for_status()
242
251
  send_response_json = response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.53
3
+ Version: 0.1.56
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
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