https://github.com/extremeheat/py2tsd
Python to TypeScript Definition generator
https://github.com/extremeheat/py2tsd
definitions python typescript
Last synced: about 2 months ago
JSON representation
Python to TypeScript Definition generator
- Host: GitHub
- URL: https://github.com/extremeheat/py2tsd
- Owner: extremeheat
- Created: 2021-07-13T08:47:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-13T11:04:21.000Z (almost 5 years ago)
- Last Synced: 2025-09-29T21:27:02.962Z (8 months ago)
- Topics: definitions, python, typescript
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# py2tsd
[](http://npmjs.com/package/py2tsd)
[](https://github.com/extremeheat/py2tsd/actions/workflows/)
[](https://gitpod.io/#https://github.com/extremeheat/py2tsd)
Python to TypeScript definition generator. Intended for use with JsPyBridge.
Uses the Python [astexporter lib written by fpoli](https://github.com/fpoli/python-astexport) to run Python AST to JSON.
## Install
```sh
npm install -g py2tsd
or
npx py2tsd
```
## Usage
```sh
py2tsd v0.0.1
Each time you run this CLI tool, we'll append to the last exported TSD. To avoid this, you can use the --clear flag.
usage: py2tsd
<[--input | -i] python directory OR installed package name>
<[--ts-out | -t] output tsd location>
[[--exclude | -x] optional regex to use to skip python files]
[[--match | -m] require match of regex string]
[--clear | -c] -- clear the workspace cache
```
```sh
npx py2tsd -i ./myPythonDir/ -o types.d.ts
npx py2tsd -i tensorflow -o tf.d.ts
npx py2tsd -i torch -o tf.d.ts -c
```