[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
| Consumer | Entry | Notes |
|---|---|---|
Bun >= 1.2 | ./src/index.ts | No bundle required |
Node >= 20 | ./dist/index.js | Run bun run build / prepack |
| Browser | ./dist/browser.js | Same package; exports.browser |
| CLI | ./src/cli.ts | Needs 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 prepack → bun 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_GRAMMAR → PYNESCRIPT_ROOT → parent PYNE checkout → sibling ../pynescript or ../pyne.
Internals
| Path | Role |
|---|---|
package.json exports | bun → src/, types → dist/index.d.ts, browser → dist/browser.js |
package.json bin.pynets | ./src/cli.ts |
scripts/build.ts | Node + browser ESM → dist/ (gitignored) |
scripts/generate-antlr.ts | ANTLR TS regen |
.github/workflows/publish.yml | npm 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
- The CLI is not a Node-native binary.
npx pynetswithout Bun will fail. - This package is not a Cloudflare Worker. There is no
wranglerhere. - Do not
npm install pynets(unscoped). The name is@hoox-sh/pynets. - Do not confuse with
pip install hoox-pyne(Python). - 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
| Symptom | Cause | Fix |
|---|---|---|
Cannot find module '@hoox-sh/pynets' | Typo / old @hoox/pynets name | Use @hoox-sh/pynets |
| Node import fails in a fresh clone | dist/ not built | bun run build |
pynets: command not found | No Bun / not on PATH | bunx pynets or bun run src/cli.ts |
| Grammar regen fails | No Java / no PYNE .g4 | Set PYNESCRIPT_ROOT or PYNETS_GRAMMAR |
| AXIS still evaluates via Python | Expected | AXIS does not consume this package |