nebu 0.1.11__py3-none-any.whl → 0.1.14__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/__init__.py CHANGED
@@ -7,3 +7,6 @@ from .config import *
7
7
  from .containers.container import Container
8
8
  from .containers.models import *
9
9
  from .meta import *
10
+ from .processors.decorate import *
11
+ from .processors.models import *
12
+ from .processors.processor import *
@@ -94,6 +94,8 @@ try:
94
94
  local_namespace,
95
95
  )
96
96
  exec("T = TypeVar('T')", local_namespace)
97
+ exec("from nebu.processors.models import *", local_namespace)
98
+ exec("from nebu.processors.processor import *", local_namespace)
97
99
 
98
100
  # First try to import the module to get any needed dependencies
99
101
  # This is a fallback in case the module is available
@@ -167,40 +167,50 @@ def processor(
167
167
 
168
168
  # Get the source code of the function
169
169
  try:
170
- function_source = inspect.getsource(func)
170
+ raw_function_source = inspect.getsource(func)
171
+ print(
172
+ f"[DEBUG Decorator] Raw source for {func.__name__}:\n{raw_function_source}"
173
+ )
174
+
171
175
  # Clean up the indentation
172
- function_source = textwrap.dedent(function_source)
173
-
174
- # Remove the @processor decorator (single or multi-line) if present
175
- lines = function_source.split("\\n")
176
- filtered_lines = []
177
- skipping_decorator = False
178
- decorator_name = "processor" # Assuming the decorator is always @processor
179
- for line in lines:
176
+ dedented_function_source = textwrap.dedent(raw_function_source)
177
+ print(
178
+ f"[DEBUG Decorator] Dedented source for {func.__name__}:\n{dedented_function_source}"
179
+ )
180
+
181
+ # Find the start of the function definition ('def')
182
+ # Skip lines starting with '@' or empty lines until 'def' is found
183
+ lines = dedented_function_source.splitlines()
184
+ func_def_index = -1
185
+ for i, line in enumerate(lines):
180
186
  stripped_line = line.strip()
181
- if stripped_line.startswith(f"@{decorator_name}"):
182
- skipping_decorator = True
183
- continue # Skip the decorator starting line itself
184
- if skipping_decorator:
185
- if stripped_line.startswith("def "):
186
- skipping_decorator = False
187
- # Add the 'def' line, as it's the start of the function
188
- filtered_lines.append(line)
189
- else:
190
- # Still inside the decorator block, skip this line
191
- continue
192
- else:
193
- # Not skipping, and not the start of the decorator, so keep the line
194
- filtered_lines.append(line)
187
+ if stripped_line.startswith("def "):
188
+ func_def_index = i
189
+ break
190
+ # Simply continue if it's not the def line.
191
+ # This skips decorators and their arguments, regardless of multi-line formatting.
192
+ continue
193
+
194
+ if func_def_index != -1:
195
+ # Keep lines from the 'def' line onwards
196
+ function_source = "\n".join(
197
+ lines[func_def_index:]
198
+ ) # Use \n for env var
199
+ else:
200
+ # If 'def' wasn't found (shouldn't happen with valid function source)
201
+ raise ValueError(
202
+ f"Could not find function definition 'def' in source for {func.__name__}"
203
+ )
195
204
 
196
- processed_function_source = "\\n".join(filtered_lines)
197
- # Update function_source with the processed version
198
- function_source = processed_function_source
205
+ print(
206
+ f"[DEBUG Decorator] Processed function source for {func.__name__}:\n{function_source}"
207
+ )
199
208
 
200
- except (IOError, TypeError):
209
+ except (IOError, TypeError) as e:
210
+ print(f"[DEBUG Decorator] Error getting source for {func.__name__}: {e}")
201
211
  raise ValueError(
202
- f"Could not retrieve source code for function {func.__name__}"
203
- )
212
+ f"Could not retrieve source code for function {func.__name__}: {e}"
213
+ ) from e
204
214
 
205
215
  # Get source code for the models
206
216
  input_model_source = None
@@ -222,7 +232,11 @@ def processor(
222
232
  output_model_source = get_type_source(return_type)
223
233
 
224
234
  # Add function source code to environment variables
235
+ print(
236
+ f"[DEBUG Decorator] Setting FUNCTION_SOURCE: {function_source[:100]}..."
237
+ ) # Print first 100 chars
225
238
  all_env.append(V1EnvVar(key="FUNCTION_SOURCE", value=function_source))
239
+ print(f"[DEBUG Decorator] Setting FUNCTION_NAME: {func.__name__}")
226
240
  all_env.append(V1EnvVar(key="FUNCTION_NAME", value=func.__name__))
227
241
 
228
242
  # Add model source codes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.11
3
+ Version: 0.1.14
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -1,4 +1,4 @@
1
- nebu/__init__.py,sha256=EbdC8ZKnRTt6jkX0WN0p1pnaDEzb2InqZ1r8QZWzph0,195
1
+ nebu/__init__.py,sha256=Frz4LWVslmGeEE_ZjCIV5riSw8RC4ZJ-gb4iQPKCOSM,299
2
2
  nebu/auth.py,sha256=rApCd-7_c3GpIb7gjCB79rR7SOcmkG7MmaTE6zMbvr0,1125
3
3
  nebu/config.py,sha256=XBY7uKgcJX9d1HGxqqpx87o_9DuF3maUlUnKkcpUrKU,4565
4
4
  nebu/meta.py,sha256=CzFHMND9seuewzq9zNNx9WTr6JvrCBExe7BLqDSr7lM,745
@@ -6,15 +6,15 @@ nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,
6
6
  nebu/containers/decorator.py,sha256=qiM7hbHne9MhSp1gDgX5z5bimsXr_YPjTIZoe09dwr4,2741
7
7
  nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
8
8
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
9
- nebu/processors/consumer.py,sha256=rFqd6gg2OYgXi3gf11GFpuaOOzuK1TYaPO-t_leSR8Y,15097
10
- nebu/processors/decorate.py,sha256=ERCYk3D6L8GAg05NSZJG73kJx-hzNCskZFaN7-oBMZY,14437
9
+ nebu/processors/consumer.py,sha256=OrhiG6qW4CcKXaNcTHV4AqXZ5M01JRFXbZhmNdU5Nsg,15232
10
+ nebu/processors/decorate.py,sha256=coIHJ6p1GhGqgoDFhNSrWRLAdpDooenr-L6JwGghRck,14953
11
11
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
12
12
  nebu/processors/models.py,sha256=GvnI8UJrQSjHo2snP07cPfisCH90cEGTY-PZV5_AtXI,3654
13
13
  nebu/processors/processor.py,sha256=oy2YdI-cy6qQWxrZhpZahJV46oWZlu_Im-jm811R_oo,9667
14
14
  nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
15
15
  nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- nebu-0.1.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- nebu-0.1.11.dist-info/METADATA,sha256=yCMJNMUGXp93yIOHWJ860NsdopJMqR2VsT-X3bM18EU,1588
18
- nebu-0.1.11.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- nebu-0.1.11.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
- nebu-0.1.11.dist-info/RECORD,,
16
+ nebu-0.1.14.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ nebu-0.1.14.dist-info/METADATA,sha256=Lo_6Ww5-zJ8MCZ7yPqCYrK1OtKOF9KpmR-ytN2FG24o,1588
18
+ nebu-0.1.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ nebu-0.1.14.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
+ nebu-0.1.14.dist-info/RECORD,,
File without changes