release: v0.8.6

This commit is contained in:
github-actions[bot]
2026-06-29 21:23:38 +00:00
parent 46bfb70666
commit e231751013
9 changed files with 239 additions and 158 deletions
+10 -2
View File
@@ -5,9 +5,17 @@ import pyarrow as pa
class DataStore:
"""Parquet data store with SQLite metadata."""
"""Bar data store (Parquet by default, or Arrow IPC via ``arrow_dir``) with SQLite metadata."""
def __init__(self, data_root: str, metadata_db: str = "metadata/metadata.sqlite") -> None: ...
def __init__(
self,
data_root: str,
metadata_db: str = "metadata/metadata.sqlite",
dataset: str = "bars_1m",
mega: Optional[str] = None,
arrow_dir: Optional[str] = None,
) -> None: ...
def dataset(self) -> str: ...
def data_root(self) -> str: ...
def metadata_db(self) -> str: ...
def active_version(self, dataset: str) -> str: ...
+9 -2
View File
@@ -98,8 +98,15 @@ def arrow_to_series(
if backend == "polars":
import polars as pl
if hasattr(array, "to_pylist"):
return pl.Series(name=name, values=array.to_pylist())
try:
import pyarrow as pa
except ImportError:
pa = None
# Zero-copy: hand the Arrow buffers straight to polars instead of boxing
# every value into a Python object via to_pylist() (copies the whole
# column). pl.from_arrow shares the underlying buffers.
if pa is not None and isinstance(array, (pa.Array, pa.ChunkedArray)):
return pl.from_arrow(array).rename(name)
return pl.Series(name=name, values=list(array))
return array
+29
View File
@@ -13,6 +13,27 @@ _EMPTY_TS = np.array([], dtype="datetime64[ns]")
_SAFETY_PRO_FEATURE = "Safety checks (lookahead, exposure)"
def _prepare_for_diagnostics(config, strategy, store):
"""Mirror ``run()``'s config/store preparation for the diagnostics path.
``run()`` resolves the config and store before serializing
(``_cap_output_resolution`` -> ``_resolve_store`` -> ``_prepare_config``).
Diagnostics must do the same: in particular a dict ``universe`` has to be
resolved to a ``List[SymbolId]`` first, otherwise ``config.to_json()`` emits
a JSON map and the Rust loader rejects it ("invalid type: map, expected a
sequence"). Returns the prepared ``(config, store)``.
"""
from manifoldbt import (
_cap_output_resolution,
_resolve_store,
_prepare_config,
)
config = _cap_output_resolution(config)
store = _resolve_store(config, store)
config = _prepare_config(config, strategy, store)
return config, store
@dataclass
class LookaheadReport:
"""Result of a single look-ahead bias test."""
@@ -289,6 +310,10 @@ def detect_lookahead(
run_on_aligned as _run_on_aligned,
)
# Resolve config/store exactly like run() (notably dict universe -> ids),
# otherwise config.to_json() emits a map the Rust loader rejects.
config, store = _prepare_for_diagnostics(config, strategy, store)
period = config.time_range_end - config.time_range_start
# Load data ONCE for the full range.
@@ -813,6 +838,10 @@ def check_exposure_stability(
run_on_aligned as _run_on_aligned,
)
# Resolve config/store exactly like run() (notably dict universe -> ids),
# otherwise config.to_json() emits a map the Rust loader rejects.
config, store = _prepare_for_diagnostics(config, strategy, store)
period = config.time_range_end - config.time_range_start
# Load data ONCE.