Repository navigation
Replies: 3 comments
|
Thanks for the write-up and for filing #96 and #97. #97 ( If the other three patches fix runtime behaviour, please file them as issues with a minimal repro against the latest PyPI release. That way the fixes land upstream and nobody has to run a modified runtime. To clear up the On the tooling side, everyone should use whichever converter works best for them. For context: PyneComp is our own Pine-to-Pyne compiler, and it is what funds the development of PyneCore and of PyneIDE, which is fully open source (GPL-3.0). It has been developed continuously for over a year and a half. Its test system covers both compilation and execution: converted scripts are run and their results compared against TradingView, and it handles a large number of Pine quirks along the way. One note for anyone reading along: we can only support bug reports that reproduce on an unmodified, current PyneCore. Reports from a patched build need a repro on the stock release first. |
|
Thanks for the detailed reply, Adam — several of these corrections change what I ship, so let me go through them one by one. #97 / P-0003 (ta. in @UDT methods):* good news, and I'll verify rather than assume. I checked PyPI: 6.11.0 is out (2026-10-25) and 6.12.1 is current. I'll re-run my 8-line repro against stock 6.12.1, and if the method-body state threading works there, I drop P-0003 from my patch set outright. That's the outcome I wanted — one less thing to carry. #96 / P-0002 + P-0004 (text.valign_*): I accept the not-planned call, with one honest caveat. My evidence for the alias was a pynecomp probe that showed the TV frontend symbol table declaring The other patches, for the record: P-0001 is packaging only (stripping the platform On On support policy: agreed — any future bug report from me will reproduce on an unmodified, current PyneCore first. That's a fair rule and it also protects my own users from chasing patched-runtime artefacts. Thanks again for engaging with the write-up rather than just the issues. I'll update the discussion once I've re-run the checks above. |
|
Thanks. One request, since this thread is public: your site's FAQ, the runtime README and your blog post still say that stock PyneCore is not a supported runtime and that these two cases fail on it. As covered above, one has worked since 6.11.0 and the other is the behaviour TradingView itself has. Please check the current release before describing PyneCore's behaviour as broken in public, and update those pages. Closing this as resolved. |
Uh oh!
There was an error while loading. Please reload this page.
Hi all — I'm ssleon228. Some of you may have seen the issues I filed here earlier (#96, #97). I built Pine2Py (pine2py.com), a transpiler that converts Pine Script to Pyne code targeting the PyneCore runtime. Since this community is the runtime side of that pipeline, I wanted to share a few conversion problems I ran into — especially one that has no clean answer — and how I ended up handling them.
1. The
strategy.*when=problemPine lets you pass a condition inline:
Pyne's strategy API has no
whenparameter, so a naive 1:1 translation produces code that fails at runtime. What I settled on:if <condition>:.when=appears in value position (where wrapping isn't possible), the argument is stripped and the transpiler emits a diagnostic telling the user that the condition was dropped, instead of silently producing wrong code.when=argument.To check the desugaring is actually equivalent, I ran both variants (original
when=form vs. desugaredifform) and compared the outputs bar by bar — they matched exactly on my test cases. One known gap: a positional (unnamed)whenargument still slips through and fails loudly at runtime; fixing that properly needs per-function parameter tables, which I haven't built yet.2. Why the output targets a patched runtime
A handful of conversion blockers turned out to be runtime-side rather than transpiler-side. I maintain a small patch set on top of PyneCore 6.10.11 (five patches, each registered with a repro), filed the two clearest cases upstream as #96 and #97, and ship the patched runtime as a download alongside the tool so converted scripts run the same way for everyone. If any of those patches are better solved upstream, I'd genuinely like to drop them.
3. How I validated (and the limits of that)
I ran the transpiler over a corpus of 1,909 public Pine scripts. In our testing, 99.7% compiled (the emitter produced Pyne code without errors) and 98.4% translated fully (no unsupported-construct diagnostics). The remaining cases are mostly exotic builtins and a few constructs where Pine's semantics don't map onto a bar-by-bar Python model without changing meaning — those get diagnostics rather than best-effort output.
If you want to try breaking it: the site gives each account 3 free conversions, no card. Hard cases and failure reports are the most useful thing you can send me — a script that converts wrong is worth more than ten that convert right.
Happy to answer questions about the transpiler side, and equally happy to hear that one of these problems has a better solution I missed.
All reactions