macropipe¶
Submodules¶
Classes¶
A miniature transformation engine based on Polars. |
Functions¶
|
Decorator to register a Macropipe recipe function. |
Package Contents¶
- class macropipe.MacroPipe¶
A miniature transformation engine based on Polars.
- expressions: List[str]¶
- registry: ClassVar[macropipe.registry.Registry]¶
- classmethod from_recipes(*recipes: str) MacroPipe¶
Create MacroPipe from list of recipes (text-based macro commands).
- resolve_function(name: str, lf: polars.LazyFrame | None = None) Callable¶
Resolve macro function by name, either from builtins or from user-registered function.
- static decode_expression(expression: str) Tuple[str, List[str]]¶
Tokenize the expression and convert it to macro invocation descriptor.
In contrast to the Python-based API, Macropipe invents a simple text-based macro language that compiles to Polars LazyFrame transformations: Function name and positional arguments are separated by colons
:, that’s it. Use\:to represent a literal colon inside an argument.<function>:<arg1>:<arg2>:<arg3>Todo
The expression language is currently pretty flat. It can certainly be improved in future iterations. Any suggestions are very much welcome.
- apply(lf: polars.LazyFrame) polars.LazyFrame¶
Convert transformation recipes to Polars expressions and apply to structured pipeline.
- macropipe.recipe(function: Callable) Callable¶
Decorator to register a Macropipe recipe function.