nebu 0.1.16__tar.gz → 0.1.18__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 (27) hide show
  1. {nebu-0.1.16/src/nebu.egg-info → nebu-0.1.18}/PKG-INFO +4 -1
  2. {nebu-0.1.16 → nebu-0.1.18}/pyproject.toml +6 -1
  3. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/containers/decorator.py +11 -3
  4. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/processors/consumer.py +16 -3
  5. nebu-0.1.18/src/nebu/processors/decorate.py +823 -0
  6. {nebu-0.1.16 → nebu-0.1.18/src/nebu.egg-info}/PKG-INFO +4 -1
  7. {nebu-0.1.16 → nebu-0.1.18}/src/nebu.egg-info/requires.txt +3 -0
  8. nebu-0.1.16/src/nebu/processors/decorate.py +0 -502
  9. {nebu-0.1.16 → nebu-0.1.18}/LICENSE +0 -0
  10. {nebu-0.1.16 → nebu-0.1.18}/README.md +0 -0
  11. {nebu-0.1.16 → nebu-0.1.18}/setup.cfg +0 -0
  12. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/__init__.py +0 -0
  13. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/auth.py +0 -0
  14. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/config.py +0 -0
  15. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/containers/container.py +0 -0
  16. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/containers/models.py +0 -0
  17. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/containers/server.py +0 -0
  18. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/meta.py +0 -0
  19. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/processors/default.py +0 -0
  20. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/processors/models.py +0 -0
  21. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/processors/processor.py +0 -0
  22. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/redis/models.py +0 -0
  23. {nebu-0.1.16 → nebu-0.1.18}/src/nebu/services/service.py +0 -0
  24. {nebu-0.1.16 → nebu-0.1.18}/src/nebu.egg-info/SOURCES.txt +0 -0
  25. {nebu-0.1.16 → nebu-0.1.18}/src/nebu.egg-info/dependency_links.txt +0 -0
  26. {nebu-0.1.16 → nebu-0.1.18}/src/nebu.egg-info/top_level.txt +0 -0
  27. {nebu-0.1.16 → nebu-0.1.18}/tests/test_containers.py +0 -0
@@ -1,13 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
8
+ Requires-Dist: dill>=0.3.8
8
9
  Requires-Dist: openai>=1.68.2
9
10
  Requires-Dist: pydantic>=2.10.6
11
+ Requires-Dist: pysocks>=1.7.1
10
12
  Requires-Dist: pyyaml>=6.0.2
13
+ Requires-Dist: redis[socks]>=5.0
11
14
  Requires-Dist: requests>=2.32.3
12
15
  Dynamic: license-file
13
16
 
@@ -1,19 +1,24 @@
1
1
  [project]
2
2
  name = "nebu"
3
- version = "0.1.16"
3
+ version = "0.1.18"
4
4
  description = "A globally distributed container runtime"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10.14"
7
7
  dependencies = [
8
+ "dill>=0.3.8",
8
9
  "openai>=1.68.2",
9
10
  "pydantic>=2.10.6",
11
+ "pysocks>=1.7.1",
10
12
  "pyyaml>=6.0.2",
13
+ "redis[socks]>=5.0",
11
14
  "requests>=2.32.3",
12
15
  ]
13
16
 
14
17
  [dependency-groups]
15
18
  dev = [
16
19
  "ipykernel>=6.29.5",
20
+ "nbformat>=5.10.4",
21
+ "notebook>=7.3.3",
17
22
  "pytest>=8.3.5",
18
23
  "trl>=0.16.1",
19
24
  ]
@@ -1,9 +1,9 @@
1
1
  import base64
2
- import inspect
3
2
  import pickle
4
3
  import time
5
4
  from typing import Any, Callable, List, Optional
6
5
 
6
+ import dill # Import dill
7
7
  import requests
8
8
 
9
9
  from nebu.containers.container import Container
@@ -47,8 +47,16 @@ def container(
47
47
  )
48
48
  time.sleep(1)
49
49
 
50
- # Get function source code
51
- func_code = inspect.getsource(func)
50
+ # Get function source code using dill
51
+ try:
52
+ func_code = dill.source.getsource(func)
53
+ except (OSError, TypeError) as e:
54
+ raise RuntimeError(
55
+ f"Failed to retrieve source code for function '{func.__name__}'. "
56
+ "This can happen with functions defined dynamically or interactively "
57
+ "(e.g., in a Jupyter notebook or REPL). Ensure the function is defined "
58
+ f"in a standard Python module if possible. Original error: {e}"
59
+ )
52
60
 
53
61
  # Serialize arguments using pickle for complex objects
54
62
  serialized_args = base64.b64encode(pickle.dumps(args)).decode("utf-8")
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  import json
3
3
  import os
4
+ import socket
4
5
  import sys
5
6
  import time
6
7
  import traceback
@@ -8,6 +9,7 @@ from datetime import datetime
8
9
  from typing import Dict, TypeVar
9
10
 
10
11
  import redis
12
+ import socks
11
13
 
12
14
  # Define TypeVar for generic models
13
15
  T = TypeVar("T")
@@ -220,13 +222,24 @@ if not all([REDIS_URL, REDIS_CONSUMER_GROUP, REDIS_STREAM]):
220
222
  print("Missing required Redis environment variables")
221
223
  sys.exit(1)
222
224
 
225
+ # Configure SOCKS proxy before connecting to Redis
226
+ # Use the proxy settings provided by tailscaled
227
+ socks.set_default_proxy(socks.SOCKS5, "localhost", 1055)
228
+ socket.socket = socks.socksocket
229
+ print("Configured SOCKS5 proxy for socket connections via localhost:1055")
230
+
223
231
  # Connect to Redis
224
232
  try:
225
- r = redis.from_url(REDIS_URL)
233
+ # Parse the Redis URL to handle potential credentials or specific DBs if needed
234
+ # Although from_url should work now with the patched socket
235
+ r = redis.from_url(
236
+ REDIS_URL, decode_responses=True
237
+ ) # Added decode_responses for convenience
238
+ r.ping() # Test connection
226
239
  redis_info = REDIS_URL.split("@")[-1] if "@" in REDIS_URL else REDIS_URL
227
- print(f"Connected to Redis at {redis_info}")
240
+ print(f"Connected to Redis via SOCKS proxy at {redis_info}")
228
241
  except Exception as e:
229
- print(f"Failed to connect to Redis: {e}")
242
+ print(f"Failed to connect to Redis via SOCKS proxy: {e}")
230
243
  traceback.print_exc()
231
244
  sys.exit(1)
232
245