Commit a3f65b8
committed
Extend get_transformer to support non-Python built-in transform types
get_transformer now handles jq, xslt, jsonld-frame, and node in addition
to python. Non-Python types are dispatched via a one-shot sub-subprocess
running under the main venv interpreter (_MAIN_PYTHON), which has all
ogc.bblocks dependencies (lxml, jq, pyld, rdflib, etc.) available
regardless of any sandboxed venv the outer Python transform may be using.
The callable signature gains an optional source_mime_type parameter so
callers can tell transforms like jsonld-frame how to parse their input.
For node transforms, npm dependencies declared in the transform's metadata
are installed into <sandbox_base>/get_transformer/<bblock_id>/<transform_id>/node
on the first call, mirroring the layout used by ordinary node sandboxes.
Implementation changes:
- TransformMetadata gains _transforms_registry and _sandbox_base_dir
(underscore-prefixed: internal, not part of the transform author API)
- _build_transforms_registry includes all _GET_TRANSFORMER_TYPES (python,
node, jq, xslt, jsonld-frame), storing the transform type alongside code
- apply_transforms passes _sandbox_base_dir=sandbox_dir to TransformMetadata
- python.py restructured: harness generation split into _NON_PYTHON_HARNESS_CODE,
_HARNESS_IMPORTS, and _HARNESS_BODY constants assembled by
_build_persistent_harness, eliminating all brace-escaping from the harness
template; _MAIN_PYTHON and _SANDBOX_BASE embedded as harness constants1 parent c1bda3d commit a3f65b8
3 files changed
Lines changed: 249 additions & 92 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
849 | | - | |
| 849 | + | |
| 850 | + | |
850 | 851 | | |
851 | 852 | | |
852 | 853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
309 | 312 | | |
310 | | - | |
| 313 | + | |
311 | 314 | | |
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
315 | 318 | | |
316 | 319 | | |
317 | | - | |
| 320 | + | |
318 | 321 | | |
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 | | |
326 | | - | |
| 329 | + | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
334 | | - | |
| 337 | + | |
335 | 338 | | |
336 | 339 | | |
337 | 340 | | |
| |||
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
| 496 | + | |
493 | 497 | | |
494 | | - | |
| 498 | + | |
495 | 499 | | |
496 | 500 | | |
497 | 501 | | |
| |||
0 commit comments