[Install PyneTS]

Add @hoox-sh/pynets with Bun, npm, or esm.sh. CLI requires Bun. Node and browsers use the ESM bundle.

Install PyneTS

Abstract

@hoox-sh/pynets is published to the npm registry. Bun imports TypeScript source. Node 20+ and browsers consume the ESM bundle in dist/. The pynets CLI is a Bun script.

Package: npmjs.com/package/@hoox-sh/pynets · source: github.com/hoox-sh/pynets. Current version 0.2.0.

Conceptual model

ConsumerEntryNotes
Bun >= 1.2./src/index.tsNo bundle required
Node >= 20./dist/index.jsRun bun run build / prepack
Browser./dist/browser.jsSame package; exports.browser
CLI./src/cli.tsNeeds Bun on PATH

Interface surface

Bun (recommended)

bun add @hoox-sh/pynets
bunx pynets -- help
bunx pynets info
import { parse, unparse, Runtime } from "@hoox-sh/pynets";

Node 20+

npm install @hoox-sh/pynets
import { parse, Runtime } from "@hoox-sh/pynets";

npm pack / publish runs prepackbun run build. If you clone the repo and import from Node without building, resolution fails.

Browser (esm.sh)

<script type="module">
  import { Runtime } from "https://esm.sh/@hoox-sh/pynets";
</script>

This is a library import, not a hosted evaluate API.

From a PYNE checkout

git clone --recurse-submodules https://github.com/hoox-sh/pyne.git
cd pyne/pynets
bun install
bun test

This PYNE pin is annotated v0.2.0 (@hoox-sh/pynets 0.2.0, interpret + JS compile). That matches npm. dist/ is gitignored — run bun run build in pynets/ if you need the Node/browser ESM bundle from the submodule. Python Runtime remains the oracle.

Develop the library

git clone https://github.com/hoox-sh/pynets.git
cd pynets
bun install
bun test
bun run typecheck
bun run build

Grammar regen (needs Java + PYNE .g4):

bun run generate

Resolution order in scripts/generate-antlr.ts: PYNETS_GRAMMARPYNESCRIPT_ROOT → parent PYNE checkout → sibling ../pynescript or ../pyne.

Internals

PathRole
package.json exportsbun → src/, types → dist/index.d.ts, browser → dist/browser.js
package.json bin.pynets./src/cli.ts
scripts/build.tsNode + browser ESM → dist/ (gitignored)
scripts/generate-antlr.tsANTLR TS regen
.github/workflows/publish.ymlnpm publish on v* tags

Local tooling is Bun only. Do not add npm/yarn/pnpm lockfiles. The npm registry is used only to publish.

Invariants & edge cases

  1. The CLI is not a Node-native binary. npx pynets without Bun will fail.
  2. This package is not a Cloudflare Worker. There is no wrangler here.
  3. Do not npm install pynets (unscoped). The name is @hoox-sh/pynets.
  4. Do not confuse with pip install hoox-pyne (Python).
  5. Engines field: "bun": ">=1.2.0", "node": ">=20".

Worked examples

Smoke the CLI

bunx pynets info --json
# { "name": "pynets", "package": "@hoox-sh/pynets", "version": "0.2.0", ... }

echo 'indicator("x")
plot(close)' > /tmp/x.pine
bunx pynets check /tmp/x.pine
# TTY: panel; pipe: "ok"

Library one-liner

import { Runtime } from "@hoox-sh/pynets";

const out = new Runtime("AAPL").run(
  `indicator("sma")\nplot(ta.sma(close, 3))`,
  [{ close: 1 }, { close: 2 }, { close: 3 }, { close: 4 }],
);
if (out.error) throw new Error(out.error);
console.log(out.plots);

Failure modes

SymptomCauseFix
Cannot find module '@hoox-sh/pynets'Typo / old @hoox/pynets nameUse @hoox-sh/pynets
Node import fails in a fresh clonedist/ not builtbun run build
pynets: command not foundNo Bun / not on PATHbunx pynets or bun run src/cli.ts
Grammar regen failsNo Java / no PYNE .g4Set PYNESCRIPT_ROOT or PYNETS_GRAMMAR
AXIS still evaluates via PythonExpectedAXIS does not consume this package

See also