Install the package
Requirements
| Environment | Minimum Version |
|---|---|
| Node.js | >= 20.1.0 |
| Browsers | ES2020+ (Chrome 80+, Firefox 78+, Safari 14+, Edge 80+) |
| TypeScript | >= 5.0 (recommended) |
numpy-ts has zero runtime dependencies. The installed size is the library itself.
CDN usage (browsers)
You can load numpy-ts directly in the browser without a build step:Choose your entry point
numpy-ts ships three entry points. Pick the one that fits your use case:| Entry Point | Import Path | Returns | Bundle Size | Use When |
|---|---|---|---|---|
| Full | numpy-ts | NDArray | ~200-300 KB | You want method chaining and the complete API |
| Core | numpy-ts/core | NDArrayCore | ~10-40 KB | Bundle size matters; you only need specific functions |
| Node | numpy-ts/node | NDArray | ~200-300 KB + fs | You need file I/O (load, save, savez) on Node.js |
Full library (numpy-ts)
The default entry point. Functions return NDArray, which supports method chaining (.add(), .reshape(), .T, etc.).
Tree-shakeable core (numpy-ts/core)
Functions return NDArrayCore (no method chaining). Your bundler (webpack, Vite, esbuild, Rollup) will only include the functions you actually import.
Node.js file I/O (numpy-ts/node)
Everything from numpy-ts plus file system operations for .npy, .npz, and text files.
Next steps
Quickstart
Create arrays, run operations, and explore the API in 5 minutes.
NumPy Migration Guide
Coming from Python NumPy? See what is different in TypeScript.
Tree-Shaking
Understand how the two entry points affect your bundle size.