1- # deno_python
1+ # Python Bridge
22
33[ ![ Tags] ( https://img.shields.io/github/release/denosaurs/deno_python )] ( https://github.com/denosaurs/deno_python/releases )
44[ ![ deno doc] ( https://doc.deno.land/badge.svg )] ( https://doc.deno.land/https/deno.land/x/python/mod.ts )
55[ ![ checks] ( https://github.com/denosaurs/deno_python/actions/workflows/checks.yml/badge.svg )] ( https://github.com/denosaurs/deno_python/actions/workflows/checks.yml )
66[ ![ License] ( https://img.shields.io/github/license/denosaurs/deno_python )] ( https://github.com/denosaurs/deno_python/blob/master/LICENSE )
77
8- This module provides a seamless integration between deno and python by
9- integrating with the [ Python/C API ] ( https://docs.python.org/3/c-api/index.html ) .
10- It acts as a bridge between the two languages, enabling you to pass data and
11- execute python code from within your deno applications. This enables access to
12- the large and wonderful [ python ecosystem ] ( https://pypi.org/ ) while remaining
13- native (unlike a runtime like the wonderful
14- [ pyodide] ( https://github.com/pyodide/pyodide ) which is compiled to wasm,
15- sandboxed and may not work with all python packages) and simply using the
16- existing python installation.
8+ This module provides a seamless integration between JavaScript (Deno/Bun) and
9+ Python by integrating with the
10+ [ Python/C API ] ( https://docs.python.org/3/c-api/index.html ) . It acts as a bridge
11+ between the two languages, enabling you to pass data and execute python code
12+ from within your JS applications. This enables access to the large and wonderful
13+ [ python ecosystem ] ( https://pypi.org/ ) while remaining native (unlike a runtime
14+ like the wonderful [ pyodide] ( https://github.com/pyodide/pyodide ) which is
15+ compiled to wasm, sandboxed and may not work with all python packages) and
16+ simply using the existing python installation.
1717
1818## Example
1919
@@ -40,6 +40,23 @@ permissions since enabling FFI effectively escapes the permissions sandbox.
4040deno run -A --unstable < file>
4141```
4242
43+ ### Usage in Bun
44+
45+ You can import from the ` bunpy ` NPM package to use this module in Bun.
46+
47+ ``` ts
48+ import { python } from " bunpy" ;
49+
50+ const np = python .import (" numpy" );
51+ const plt = python .import (" matplotlib.pyplot" );
52+
53+ const xpoints = np .array ([1 , 8 ]);
54+ const ypoints = np .array ([3 , 10 ]);
55+
56+ plt .plot (xpoints , ypoints );
57+ plt .show ();
58+ ```
59+
4360### Dependencies
4461
4562Normally deno_python follows the default python way of resolving imports, going
0 commit comments