Skip to main content

Crate quarb_pyvalue

Crate quarb_pyvalue 

Source
Expand description

Quarb values as Python objects and back — the one pyo3 mapping, used in both directions: the Python bindings (quarb-py) hand query results to Python with it, and a command library that embeds Python (quarb-lib-morph, quarb-lib-scipy, quarb-lib-sklearn) hands operands in and takes results out with it; glue holds the call plumbing those libraries share.

null ↔ None; booleans, integers, floats and strings to their Python selves; a list ↔ list; a record ↔ dict (insertion order kept); an instant ↔ a tz-aware datetime; a duration ↔ timedelta; a quantity ↔ Quantity; a period crosses as its ISO text. Coming back, a tuple is a list too, a named tuple (and scipy’s result objects) a record, a numpy scalar its item, and any other object a library value (PyForeign; spec: Command Libraries, “A library value”), kept as it is for the next command and handed back whole when it crosses into Python again.

Re-exports§

pub use foreign::PyForeign;
pub use glue::PyGlue;
pub use glue::importable;
pub use reflect::Reflective;

Modules§

foreign
A Python object as a library value (spec: Command Libraries, “A library value”): what a Python-wrapping library keeps in its own form between two commands — a frame, an array, any object that is not plain data. The engine sees its kind, its text and its two exports; the libraries take the object back as it is.
glue
The shared plumbing of a command library that wraps a Python package: a page of Python glue compiled once into a module, the input slot filled from the synopsis, operands as positional arguments and options as keyword arguments, the result mapped back, a Python exception as a failed call, and the importability check behind a library’s run-time requirement.
reflect
A command library that reflects the Python package it wraps (spec: Command Libraries, “Reflected commands”): every function and method of the package is a command, its synopsis read from the function’s own signature when the gate first meets the name, its documentation the first line of the function’s docstring.

Structs§

Quantity
A dimensioned value: the magnitude in the engine’s SI-base expansion (unit, e.g. m, kg*m^2/s^3), with the authored form kept for display (written, e.g. 42 km) when the source carried one.

Functions§

py_to_value
A Python object as an engine Value: the mapping above read the other way. A datetime crosses as an instant on its own timeline (naive ones as UTC), a timedelta as a duration, a tuple as a list, a named tuple (scipy’s result objects among them, their extra fields included) as a record, a set as a list in iteration order, a numpy scalar as its item, and any other object as a library value.
value_to_py
An engine Value as its natural Python object.