API reference
This page documents pipescript’s importable Python API – the helper functions
re-exported from the top-level pipescript namespace, plus the entry point for
registering namespace-block macros. Most day-to-day pipescript is syntax
rather than API; you will typically reach for these names only when writing your
own macros or calling a helper directly.
Helper functions
These are re-exported from pipescript (via pipescript.api) and are
also the implementations behind several built-in macros (see
Macros and helpers).
- pipescript.api.static_macros.do(func: Callable[[T, Unpack[tuple[T]]], Any], obj: T, *extra: T) T | tuple[T, ...][source]
- pipescript.api.static_macros.expect(func: Callable[[T, Unpack[tuple[T]]], bool], obj: T, *extra: T) T | tuple[T, ...][source]
- pipescript.api.static_macros.fork(funcs: tuple[Callable[[T, Unpack[tuple[T]]], Any]], obj: T, *extra: T) tuple[Any, ...][source]
- pipescript.api.static_macros.future(func: Callable[[T, Unpack[tuple[T]]], R], obj: T, *extra: T) Future[R][source]
- pipescript.api.static_macros.parallel(funcs: tuple[Callable[[T, Unpack[tuple[T]]], Any]], obj: T, *extra: T) tuple[Any, ...][source]
- pipescript.api.static_macros.repeat(func: Callable[[T, Unpack[tuple[T]]], T], obj: T, *extra: T) T | tuple[T, ...][source]
- pipescript.api.static_macros.unless(func: Callable[[T, Unpack[tuple[T]]], bool], obj: T, *extra: T) T | tuple[T, ...][source]
- pipescript.api.static_macros.until(func: Callable[[T, Unpack[tuple[T]]], bool], obj: T, *extra: T) T | tuple[T, ...][source]
Registering namespace-block macros
- pipescript.tracers.macro_tracer.register_namespace_macro(name: str, builder: Callable[[dict], Any], call_form: Callable[[...], Any] | None = None) None[source]
Register
name{ a = ...; b = ... }as a namespace-block macro.The brace block is run and its top-level assignments harvested into a dict, which is passed to
builder; the macro evaluates tobuilder(namespace).call_form, if given, is exposed as the bare namename(a builtin in a pipescript session) so the ordinary call formname(a=..., b=...)works too; pass the function thatbuilderdelegates to. Registration must happen before the cell/code using the macro is processed.