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 +3 -0
- nebu/processors/consumer.py +2 -0
- nebu/processors/decorate.py +43 -29
- {nebu-0.1.11.dist-info → nebu-0.1.14.dist-info}/METADATA +1 -1
- {nebu-0.1.11.dist-info → nebu-0.1.14.dist-info}/RECORD +8 -8
- {nebu-0.1.11.dist-info → nebu-0.1.14.dist-info}/WHEEL +0 -0
- {nebu-0.1.11.dist-info → nebu-0.1.14.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.11.dist-info → nebu-0.1.14.dist-info}/top_level.txt +0 -0
nebu/__init__.py
CHANGED
nebu/processors/consumer.py
CHANGED
@@ -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
|
nebu/processors/decorate.py
CHANGED
@@ -167,40 +167,50 @@ def processor(
|
|
167
167
|
|
168
168
|
# Get the source code of the function
|
169
169
|
try:
|
170
|
-
|
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
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
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(
|
182
|
-
|
183
|
-
|
184
|
-
if
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
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
|
-
|
197
|
-
|
198
|
-
|
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,4 +1,4 @@
|
|
1
|
-
nebu/__init__.py,sha256=
|
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=
|
10
|
-
nebu/processors/decorate.py,sha256=
|
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.
|
17
|
-
nebu-0.1.
|
18
|
-
nebu-0.1.
|
19
|
-
nebu-0.1.
|
20
|
-
nebu-0.1.
|
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
|
File without changes
|
File without changes
|