nebu 0.1.10__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,14 +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
- except (IOError, TypeError):
174
- raise ValueError(
175
- f"Could not retrieve source code for function {func.__name__}"
176
+ dedented_function_source = textwrap.dedent(raw_function_source)
177
+ print(
178
+ f"[DEBUG Decorator] Dedented source for {func.__name__}:\n{dedented_function_source}"
176
179
  )
177
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):
186
+ stripped_line = line.strip()
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
193
+ else:
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
+ )
198
+
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
+ )
209
+
210
+ print(
211
+ f"[DEBUG Decorator] Processed function source for {func.__name__}:\n{function_source}"
212
+ )
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
+
178
220
  # Get source code for the models
179
221
  input_model_source = None
180
222
  output_model_source = None
@@ -195,7 +237,11 @@ def processor(
195
237
  output_model_source = get_type_source(return_type)
196
238
 
197
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
198
243
  all_env.append(V1EnvVar(key="FUNCTION_SOURCE", value=function_source))
244
+ print(f"[DEBUG Decorator] Setting FUNCTION_NAME: {func.__name__}")
199
245
  all_env.append(V1EnvVar(key="FUNCTION_NAME", value=func.__name__))
200
246
 
201
247
  # Add model source codes
nebu/processors/models.py CHANGED
@@ -94,7 +94,7 @@ class V1StreamData(BaseModel):
94
94
  wait: Optional[bool] = None
95
95
 
96
96
 
97
- class V1StreamMessage(Generic[T], BaseModel):
97
+ class V1StreamMessage(BaseModel, Generic[T]):
98
98
  kind: str = "StreamMessage"
99
99
  id: str
100
100
  content: Optional[T] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.10
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=8jemT7QvY-2aAJAOiYzjClja-Zso0QgWXZH377uIW4I,13126
10
+ nebu/processors/decorate.py,sha256=m5zDs7wxHLS0drgTwXUQTiUEFml1qoYDuVY8VMsgHQs,15218
11
11
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
12
- nebu/processors/models.py,sha256=JpX5GouqdIdCQWUUNzQh68OsD57_Po2aQreDQ9VMRec,3654
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.10.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- nebu-0.1.10.dist-info/METADATA,sha256=apL1G3eCfv0BncDZL5Sqq4mc2e4yeA2sTmbMgACQOlU,1588
18
- nebu-0.1.10.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- nebu-0.1.10.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
- nebu-0.1.10.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