Skip to content

v6.12.0

Latest

Choose a tag to compare

@wallneradam wallneradam released this 30 Oct 15:11
· 13 commits to main since this release

Native transform

  • The AST transform pipeline now runs in Rust. Every transform step has a native port in rust/, built into the wheels as pynecore.transformers._native. It produces the same tree as the Python steps: each port is checked against its Python step, and the wheels and the release are gated on that parity. Measured over 1065 real-world Pyne code files, the whole transform (analysis and lowering) took 40.5 s natively against 98.0 s in Python. The transform runs when a script or library is compiled into its bytecode cache, not on every bar, so this shortens the first run and the run after an edit.
  • PYNE_AST_BACKEND selects the backend: native (the default) runs every step that has a current native port natively, python runs the pure-Python pipeline, verify runs both and fails on any difference. A Python step edited after its port was made is detected and runs in Python, with one warning per process. Without the extension (a platform with no binary wheel, or PYNE_BUILD_PURE=1), every step runs in Python as before.
  • The same pipeline builds for WebAssembly, so the transform can run where there is no Python interpreter.
  • Imported modules are no longer executed at compile time. The transform used to import modules to classify the functions a script calls from them, and resolving a dotted name imported every package on the way, so a library reached through a package ran during compilation and registered before the script's own imports. Callees are now routed from what the module's source binds, without running it.

Fixes

  • math.sum and ta.sma follow TradingView's new engine: TradingView replaced its rolling-sum engine between 2026-07-31 and 2026-10-29, and its output differs from the previous one from the first bars on. PyneCore now uses the same compensated rolling sum (the residue of a large value leaving the window stays in the compensation, as on TradingView), validated bit for bit on 396045 TradingView bars across lengths 2 to 300, spikes, na bars and changing lengths. On an na bar, a growing length now admits values only up to the window's edge. Results of these builtins and of indicators built on them can differ in the last digits from the previous release.
  • ta.cog computes its numerator newest-first over the window and its denominator with the math.sum engine, as TradingView does; it was one ulp off on nearly every bar.
  • ta.sar follows TradingView's reference computation: the initial trend is decided by close > close[1] (a tie starts short), bar 1 runs a full step instead of returning the start value, the two-bar clip reads two bars back only from bar 2 on, and comparisons are tolerant like Pine's.
  • request.security with lookahead_on: closed higher-timeframe bars of a same-symbol context were built by folding chart bars, which is not the real bar when the chart timeframe does not divide the requested one ("5" on a 3-minute chart), when the chart starts inside a period or has a gap in it, or on D/W/M charts. Closed bars now come from the context's own data, and the chart bars build only the developing bar. A period the context's data has no bar for is skipped, so [1] steps over it. (#100)
  • request.security in libraries: a library's request.security context could run the script's same-numbered context instead of its own, and a script context and a library context with the same group number were merged, which failed with "proved to name the same feed" when their data differed. Each context now runs in the module that declared it.
  • Constant folding of Pine ints: a Pine int is a double, but constant integer expressions were folded with exact Python ints. 9007199254740993 - 9007199254740992 now folds to 0, as on TradingView, instead of 1.

Build

  • Platform wheels carry the native transform, built with setuptools-rust as an optional extension; the sdist carries the Rust sources. Every wheel runs the native-versus-Python parity tests before it can be published.

Documentation

  • The request.security page describes where the closed bars of a lookahead_on context come from.