End User Hub

Install PYNE (pip install hoox-pyne), run CLI/library eval with mode=auto, wire editors (.pyne/.pine), and call Pro API alerts + webhooks.

This page

End User Hub

This track is for people who consume PYNE: parse and reformat Pine Script™, lint before upload, evaluate expressions or full scripts against OHLCV (mode=auto / interpret / compile), export alerts (optional L2 webhooks), wire an editor via LSP (.pyne / .pine), or call the HTTP evaluate contract. Contributor internals (grammar regeneration, AST builder, bar-loop semantics) live under Core, Runtime, and DevOps.

Abstract

PYNE exposes one language pipeline through several thin surfaces:

.pyne / .pine source
  → parse (ANTLR4 + ASDL AST)
  → optional: dump | unparse | lint | walk/transform
  → optional: evaluate (literal_eval | Runtime mode=auto|interpret|compile)
  → plots / fill / events / drawings / alerts / metrics
  → optional L2 webhooks (Pro API / edge)

The desk path is the pyne Click CLI (alias pynescript) and pynescript.ast / pynescript.runtime library API (PyPI distribution name hoox-pyne). The TypeScript desk path is PyneTS (bun add @hoox-sh/pynets). The editor path is pyne-lsp (alias pynescript-lsp; stdio; first-class .pyne association). The HTTP path is the Flask Pro API (POST /run with alerts export + webhooks, POST /optimize, preview, backtest). The optional chart is AXIS; the optional trade mesh is HOOX. Evaluation does not require either. Defaults for mode differ by surface — modes.

Conceptual model

Diagram

Rendering…

SurfaceEntryTypical job
CLIpyne … (alias pynescript)One-shot parse, format, lint, compile, run, optimize, prewarm, data
Libraryfrom pynescript.ast import parse, unparseEmbed parse/transform/eval in tools
PyneTSimport { parse, Runtime } from "@hoox-sh/pynets"Same names in TypeScript / Bun
LSPpyne-lsp (alias pynescript-lsp)Diagnostics, completion, hover (.pyne / .pine)
Pro APIPOST /run · POST /optimizeEvaluate contract + strategy input.* search
AXISseparate productChart PWA AXIS over evaluate results
HOOXseparate productEdge execution mesh after strategy events

Choose your path

1. Getting started

New install, first parse, and environment knobs:

  • Installation — PyPI pip install hoox-pyne (import pynescript), extras (lsp, compile, data, pro), Hatch checkout, smoke checks.
  • Quick start — Parse → dump → unparse → lint → literal_eval in under ten minutes.
  • Configuration — Extras, console scripts, Pro API env vars (ALERT_WEBHOOK_URL, compile cache), editor settings.

2. Operational guides

Daily workflows against the same pipeline:

  • CLIcheck, format, lint, compile, prewarm, run, optimize, data, …
  • Library APIparse, unparse, dump, walk, visitors, transformers, linter, optimize.run_study.
  • Evaluate scripts — Expression eval, bar-loop Runtime (mode=auto), strategy events, alerts export, mock vs live data.
  • Editors — VS Code (.pyne first-class), Neovim, Zed, Emacs, Helix; clients/ snippets.
  • Pro API usage/run (+ webhook_url / L2 webhooks), /run/batch, /optimize, preview, backtest as a consumer.
  • Troubleshooting — Parse failures, recursion limits, missing extras, CORS, auth.

3. Reference

  • CLI commands — Full option trees for every Click command.
  • Modesinterpret / compile / auto defaults: library interpret, POST /run auto, pyne run compile-only.
  • Glossary — AST, series, bar-loop, Runtime, ASDL, and related terms.
  • FAQ — Version support, TradingView parity, licensing, AXIS/HOOX boundaries.

Interface surface (consumer map)

WantCommand / importDocs
Install corepip install hoox-pyne (import pynescript)Installation
Install LSPpip install "hoox-pyne[lsp]"Editors
Install market data depspip install "hoox-pyne[data]"CLI data
Parse filepyne parse-and-dump path.pyneCLI
Normalize sourcepyne parse-and-unparse path.pineCLI
Lintpyne lint path.pineCLI
Library parsefrom pynescript.ast import parse, unparseLibrary API
Expression evalfrom pynescript.ast.helper import literal_evalEvaluate
Bar-loop evalfrom pynescript.runtime import Runtime (mode default interpret)Evaluate · modes
Incremental interpretRuntime.create_sessionappend_bars / update_last_bar (0.6.1)Evaluate
Compile-only smokepyne run script.pine --bars 50CLI
Warm Numba / IRpyne prewarm / POST /compile/prewarmCLI
Strategy HPOpyne optimize / POST /optimize / pynescript.optimize.run_studyOptimize
Alerts + webhooks/runalerts[] / webhook_urlAlerts
Start LSPpyne-lsp (stdio)Editors
Local Pro APImake run / python -m backend.appPro API usage

Preferred console scripts (aliases in parentheses) are registered in pyproject.toml:

ScriptModuleRole
pyne (pynescript)pynescript.__main__:cliDesk CLI (Click group)
pyne-lsp (pynescript-lsp)pynescript.langserver.__main__:mainLanguage server (pygls)

Do not conflate them: lint and parse live on pyne; editor features live on pyne-lsp.

Internals (repo paths)

Consumer-relevant code only — deeper design is linked from each guide:

PathRole
src/pynescript/__main__.pyClick CLI: check, format, lint, compile, prewarm, run, optimize, data, info
src/pynescript/ast/helper.pyPublic parse, unparse, dump, walk, literal_eval
src/pynescript/ast/linter.pylint_script / PineLinter
src/pynescript/ast/evaluator/Bar-aware and literal evaluators
src/pynescript/runtime/Package Runtime SoT (bar-loop host, series, CustomEvaluator)
src/pynescript/langserver/LSP features and server
src/pynescript/util/data.pyHistorical data providers (mock, yahoo, alphavantage, ccxt)
backend/app.pyFlask Pro API entry (/run, auth, blueprints)
backend/runtime.pyCompat shim → pynescript.runtime
examples/Worked scripts (parse, RSI strategy, datafeed)
clients/Editor client configs (Neovim, Zed, Emacs)
vscode-extension/VS Code extension package

Invariants & edge cases

  • Round-trip is first-class. parseunparse should preserve semantics; use it to normalize formatting, not as a semantic rewrite.
  • Mode split. parse(..., mode="exec") yields a script tree; mode="eval" parses a single expression (used by literal_eval).
  • No proprietary host required. Evaluation works offline with mock or supplied OHLCV; AXIS/HOOX are optional.
  • Extras are opt-in. Core parse/lint needs only base deps (antlr4-python3-runtime, click, …). LSP needs [lsp]; CCXT paths need [data] / [datafeed].
  • Optional example dir. pinescript_filepath only expands when --example-scripts-dir points at local *.pine files; no third-party corpus is shipped.

Worked examples

Minimal library round-trip:

from pynescript.ast import parse, unparse

source = """
//@version=6
indicator("My RSI")
plot(ta.rsi(close, 14))
"""
tree = parse(source)
print(unparse(tree))

Minimal CLI:

pip install hoox-pyne
pyne parse-and-dump examples/rsi_strategy.pine
pyne lint examples/rsi_strategy.pine

Minimal HTTP evaluate (local server running):

curl -s http://127.0.0.1:5002/ \
  | python -m json.tool

Failure modes

SymptomLikely causeWhere to go
pyne: command not foundPackage not on PATH / venv inactiveInstallation
pyne-lsp missingInstalled without [lsp] extraEditors
SyntaxError on parseGrammar mismatch or truncated sourceTroubleshooting
/run 400 NO_DATAMissing OHLCV listPro API usage
Numerical drift vs TradingViewBuiltin / series edge caseCompatibility

See also