Skip to content

Use Python libraries in your TypeScript app.

Run your existing Python functions from TypeScript, with generated signatures and autocomplete. Bring NumPy, pandas, and SciPy into your app without writing each wrapper by hand.

A lifelike snake moving in a continuous loop.

Working with a coding agent? Give it the tywrap guide.

Open guide

Reuse your Python work

Connect existing calculations and data tools to your TypeScript app.

Write less integration code

Generate callable functions from Python annotations, with parameter and return types in your editor.

Work with scientific data

Return NumPy arrays and pandas tables to your app. Node and Bun can use Arrow for binary transfer.

Choose where Python runs

Use a local Python process with Node or Bun, or run Python in the browser with Pyodide.

Try it ​

Install the TypeScript package and Python generator. Then create a config and generate wrappers for the Python modules you want to call.

bash
npm install tywrap
pip install tywrap-ir  # Python component for code generation
npx tywrap init
npx tywrap generate

tywrap and tywrap-ir are versioned independently. Install the latest published release of each package unless you need to pin them explicitly.

typescript
import { NodeBridge } from 'tywrap/node';
import { setRuntimeBridge } from 'tywrap/runtime';
import * as math from './generated/math.generated.js';

setRuntimeBridge(new NodeBridge({ pythonPath: 'python3' }));
const result = await math.sqrt(16); // 4

See the getting started guide to configure your own Python module and choose a runtime bridge.

Experimental: APIs may change before v1.0.0. See Releases for breaking changes.

Released under the MIT License.