nebu 0.1.11__py3-none-any.whl → 0.1.12__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.
@@ -167,41 +167,56 @@ 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
187
+ if stripped_line.startswith("def "):
188
+ func_def_index = i
189
+ break
190
+ elif stripped_line.startswith("@") or not stripped_line:
191
+ # Skip decorator lines and empty lines before 'def'
192
+ continue
192
193
  else:
193
- # Not skipping, and not the start of the decorator, so keep the line
194
- filtered_lines.append(line)
194
+ # Found something unexpected before 'def'
195
+ raise ValueError(
196
+ f"Unexpected content found before 'def' in source for {func.__name__}. Cannot reliably strip decorators."
197
+ )
195
198
 
196
- processed_function_source = "\\n".join(filtered_lines)
197
- # Update function_source with the processed version
198
- function_source = processed_function_source
199
+ if func_def_index != -1:
200
+ # Keep lines from the 'def' line onwards
201
+ function_source = "\n".join(
202
+ lines[func_def_index:]
203
+ ) # Use \n for env var
204
+ else:
205
+ # If 'def' wasn't found (shouldn't happen with valid function source)
206
+ raise ValueError(
207
+ f"Could not find function definition 'def' in source for {func.__name__}"
208
+ )
199
209
 
200
- except (IOError, TypeError):
201
- raise ValueError(
202
- f"Could not retrieve source code for function {func.__name__}"
210
+ print(
211
+ f"[DEBUG Decorator] Processed function source for {func.__name__}:\n{function_source}"
203
212
  )
204
213
 
214
+ except (IOError, TypeError) as e:
215
+ print(f"[DEBUG Decorator] Error getting source for {func.__name__}: {e}")
216
+ raise ValueError(
217
+ f"Could not retrieve source code for function {func.__name__}: {e}"
218
+ ) from e
219
+
205
220
  # Get source code for the models
206
221
  input_model_source = None
207
222
  output_model_source = None
@@ -222,7 +237,11 @@ def processor(
222
237
  output_model_source = get_type_source(return_type)
223
238
 
224
239
  # Add function source code to environment variables
240
+ print(
241
+ f"[DEBUG Decorator] Setting FUNCTION_SOURCE: {function_source[:100]}..."
242
+ ) # Print first 100 chars
225
243
  all_env.append(V1EnvVar(key="FUNCTION_SOURCE", value=function_source))
244
+ print(f"[DEBUG Decorator] Setting FUNCTION_NAME: {func.__name__}")
226
245
  all_env.append(V1EnvVar(key="FUNCTION_NAME", value=func.__name__))
227
246
 
228
247
  # 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.12
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -7,14 +7,14 @@ nebu/containers/decorator.py,sha256=qiM7hbHne9MhSp1gDgX5z5bimsXr_YPjTIZoe09dwr4,
7
7
  nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
8
8
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
9
9
  nebu/processors/consumer.py,sha256=rFqd6gg2OYgXi3gf11GFpuaOOzuK1TYaPO-t_leSR8Y,15097
10
- nebu/processors/decorate.py,sha256=ERCYk3D6L8GAg05NSZJG73kJx-hzNCskZFaN7-oBMZY,14437
10
+ nebu/processors/decorate.py,sha256=m5zDs7wxHLS0drgTwXUQTiUEFml1qoYDuVY8VMsgHQs,15218
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.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ nebu-0.1.12.dist-info/METADATA,sha256=QEN1FBqo3AsqbtLdcOnu7wqiYf6Las8cI1dRrL8V7oY,1588
18
+ nebu-0.1.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ nebu-0.1.12.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
+ nebu-0.1.12.dist-info/RECORD,,
File without changes