Skip to main content

Install the package

Requirements

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 two entry points. Pick the one that fits your use case: See the Tree-Shaking guide for a detailed comparison.

Full library (numpy-ts)

The default entry point. Functions return NDArray, which supports method chaining (.add(), .reshape(), .T, etc.). On server runtimes (Node.js, Bun, Deno), file I/O operations (loadNpy, saveNpy, loadNpzFile, savez, loadtxt, savetxt) are available directly. In browsers, calling file I/O functions throws a clear error.
Best for applications, scripts, and projects where developer experience matters more than bundle size.

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.
Best for libraries, frontend apps where every kilobyte counts, and when you only need a handful of functions.
Importing just array and add from numpy-ts/core results in a bundle around 10 KB minified. The full entry point is always ~200-300 KB regardless of what you use.

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.