[Installation]

Install pynescript from PyPI or a source checkout, select extras for LSP and market data, and verify the CLI and library imports.

Installation

Abstract

PYNE ships as the Python package pynescript (src-layout under src/pynescript/). The default install gives you the Click CLI (pynescript) and the AST library (parse, unparse, dump, walk, literal_eval, linter). Optional extras add the Language Server (pynescript-lsp) and CCXT-backed market data. A Hatch-managed checkout is the supported path for contributors who need tests, grammar tooling, or the Flask Pro API in-tree.

Conceptual model

Install flavorWhat you getWhen
pip install pynescriptCLI + libraryDesk use, scripts, CI lint
pip install "pynescript[lsp]"+ pygls LSP serverEditors
pip install "pynescript[data]"+ ccxtLive/historical exchange data
pip install -e ".[dev-lsp]"Editable + LSP test harnessContributing to LSP
Hatch envMatrix tests, lint, docsFull monorepo workflow

Interface surface

Prerequisites

  • Python ≥ 3.10 (classifiers declare 3.10–3.12; 3.13 may work in CI — pin to 3.10+ for production)
  • pip or an equivalent installer; virtualenv strongly recommended
  • For Pro API locally: flask, flask-cors, numpy, matplotlib (see backend/requirements.txt)
  • For VS Code extension build: Node 22+ under vscode-extension/ (optional)

Core install (PyPI / local package)

From a release or built wheel:

pip install pynescript

From a cloned monorepo root (non-editable):

pip install .

Editable (preferred for development):

pip install -e .
# or with Make:
make install

Extras

Defined in pyproject.toml under [project.optional-dependencies]:

# Language Server (pygls + lsprotocol)
pip install "pynescript[lsp]"

# CCXT for exchange data / datafeed
pip install "pynescript[data]"
# alias:
pip install "pynescript[datafeed]"

# LSP + pytest-lsp for protocol tests
pip install -e ".[dev-lsp]"

Combine extras:

pip install -e ".[lsp,data]"

Hatch (contributor)

# Install Hatch if needed, then:
hatch shell
hatch run test:test
hatch run lint:style

Make targets used in-repo (see AGENTS.md):

make install         # pip install -e ".[lsp]"
make test            # pytest tests/ -v --tb=short
make lint            # ruff check src/ tests/ backend/
make run             # python -m backend.app
make run-lsp         # python -m pynescript.langserver
make build-check     # fast import check without Nuitka

Console scripts

After install, two entry points should resolve:

CommandPurpose
pynescriptClick CLI group
pynescript-lspLanguage server (requires [lsp])
pynescript --version
pynescript --help
which pynescript-lsp   # only after [lsp]

Internals (repo paths)

PathRole
pyproject.tomlPackage metadata, deps, optional extras, scripts
src/pynescript/Library + CLI + LSP package tree
src/pynescript/__about__.py__version__ (e.g. 0.2.0)
src/pynescript/__main__.pyCLI implementation
src/pynescript/langserver/__main__.pypynescript-lsp entry
backend/requirements.txtPro API server deps (not in core extras)
MakefileConvenience install / test / run targets
CONTRIBUTING.mdHatch-based contributor workflow

Base runtime dependencies (core):

  • antlr4-python3-runtime>=4.13.1
  • click>=8.1.7
  • requests
  • tqdm

Invariants & edge cases

  • License. Package license is AGPL-3.0-or-later (pyproject.toml). Network use triggers AGPL source-offer obligations (see GNU AGPL §13); consult your counsel for commercial embedding.
  • Src layout. Imports are pynescript.*, not a flat package. Editable install requires hatchling to map src/.
  • LSP is not a CLI subcommand of pynescript in the current Click group. README sometimes says pynescript lsp; the registered script is pynescript-lsp.
  • Pro API is not a pip extra. Run from monorepo with backend deps, or call a hosted endpoint. Local: make run binds HOST/PORT (default 127.0.0.1:5002).
  • Anaconda / Nuitka. Building the onefile LSP binary may need libpython-static or --static-libpython=no (see build docs). End users rarely need this.
  • Generated artifacts. Do not hand-edit src/pynescript/ast/grammar/antlr4/generated/ or ASDL generated modules.

Worked examples

Smoke-test CLI and library

python - <<'PY'
from pynescript.ast import parse, unparse
from pynescript import __about__
print("version", __about__.__version__)
src = '//@version=5\nindicator("t")\nplot(close)\n'
print(unparse(parse(src)))
PY

pynescript parse-and-dump examples/rsi_strategy.pine | head
pynescript lint examples/rsi_strategy.pine

Fresh venv recipe

python3.12 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install "pynescript[lsp,data]"
pynescript --version
pynescript-lsp --help 2>/dev/null || true  # server may only speak stdio

Monorepo desk + Pro API

git clone https://github.com/jango-blockchained/pynescript.git
cd pynescript
pip install -e ".[lsp]"
pip install -r backend/requirements.txt
make run   # Flask on :5002

CI-style install

pip install .
# or matrix:
# pip install -e ".[dev-lsp]"
pytest tests/test_parse_and_unparse.py -q

Failure modes

FailureDiagnosisFix
ModuleNotFoundError: pynescriptWrong env / not installedActivate venv; reinstall
No module named 'pygls'LSP import without extrapip install "pynescript[lsp]"
No module named 'ccxt'data CLI/provider pathpip install "pynescript[data]"
pynescript not foundScripts not on PATHUse python -m pynescript or fix venv bin/
Import error from editableIncomplete install / broken pathRe-run pip install -e . from repo root
Backend ImportError: flaskPro API without backend depspip install -r backend/requirements.txt
ANTLR / grammar mismatch on odd syntaxOlder package vs newer scriptsUpgrade package; see Troubleshooting

See also