Metadata-Version: 2.4
Name: pythscribe
Version: 0.2.9
Summary: `@wasm` for ordinary Python: sandboxed WebAssembly, in the browser or on the server.
License-Expression: MIT AND LicenseRef-FSL-1.1-ALv2
Project-URL: Homepage, https://github.com/swetmr/pythscribe
Project-URL: Source, https://github.com/swetmr/pythscribe
Project-URL: Issues, https://github.com/swetmr/pythscribe/issues
Project-URL: Documentation, https://github.com/swetmr/pythscribe/blob/main/pythscribe/README.md
Keywords: webassembly,wasm,gradio,streamlit,sandbox,wasmtime,compiler,python
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: pythscribe/LICENSE
License-File: LICENSE.md
License-File: pythscribe/_runtime/pyths-runtime/LICENSE
License-File: pythscribe/LICENSES-MAP.md
License-File: third_party/README.md
License-File: third_party/THIRD_PARTY_NOTICES.md
License-File: third_party/inventory.json
License-File: third_party/notices/001_MIT.txt
License-File: third_party/notices/002_MIT.txt
License-File: third_party/notices/003_MIT.txt
License-File: third_party/notices/004_MIT.txt
License-File: third_party/notices/005_MIT.txt
License-File: third_party/notices/006_MIT.txt
License-File: third_party/notices/007_MIT.txt
License-File: third_party/notices/008_MIT.txt
License-File: third_party/notices/009_MIT.txt
License-File: third_party/notices/010_MIT.txt
License-File: third_party/notices/011_MIT.txt
License-File: third_party/notices/012_MIT.txt
License-File: third_party/notices/013_MIT.txt
License-File: third_party/notices/014_MIT.txt
License-File: third_party/notices/015_MIT.txt
License-File: third_party/notices/016_MIT.txt
License-File: third_party/notices/017_MIT.txt
License-File: third_party/notices/018_MIT.txt
License-File: third_party/notices/019_MIT.txt
License-File: third_party/notices/020_MIT.txt
License-File: third_party/notices/021_MIT.txt
License-File: third_party/notices/022_MIT.txt
License-File: third_party/notices/023_MIT.txt
License-File: third_party/notices/024_MIT.txt
License-File: third_party/notices/025_MIT.txt
License-File: third_party/notices/026_MIT.txt
License-File: third_party/notices/027_Unicode-3.0.txt
License-File: third_party/notices/028_Zlib.txt
Requires-Dist: wasmtime>=48
Provides-Extra: gradio
Requires-Dist: gradio<7,>=6; extra == "gradio"
Provides-Extra: streamlit
Requires-Dist: streamlit>=1.37; extra == "streamlit"
Provides-Extra: all
Requires-Dist: gradio<7,>=6; extra == "all"
Requires-Dist: streamlit>=1.37; extra == "all"
Provides-Extra: web-bundled
Requires-Dist: nodejs-wheel-binaries<23,>=22.12; extra == "web-bundled"
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Requires-Dist: pytest-timeout>=2; extra == "test"
Requires-Dist: hypothesis>=6; extra == "test"
Requires-Dist: playwright>=1.50; extra == "test"
Requires-Dist: wasmtime>=48; extra == "test"
Requires-Dist: gradio<7,>=6; extra == "test"
Requires-Dist: pyyaml>=6; extra == "test"
Requires-Dist: pillow>=10; extra == "test"
Requires-Dist: numpy>=1.26; extra == "test"
Requires-Dist: matplotlib>=3.8; extra == "test"
Requires-Dist: nbformat>=5; extra == "test"
Requires-Dist: nbclient>=0.10; extra == "test"
Requires-Dist: ipykernel>=6; extra == "test"
Requires-Dist: streamlit>=1.37; extra == "test"
Requires-Dist: numba>=0.60; extra == "test"
Dynamic: license-file

# pythscribe — `@wasm` for ordinary Python

**One decorator. Your function stays Python. It runs compiled — in the browser tab, in-process on the
server (sandboxed, GIL-free, bit-for-bit), or as plain Python when nothing is built — and you can always
tell which.**

```bash
pip install pythscribe               # everything: the @wasm decorator, the compiler, the wasm runtime, both adapters
pip install pythscribe[gradio]       # + Gradio (the custom component ships inside the wheel)
pip install pythscribe[streamlit]    # + Streamlit
pip install pythscribe[web-bundled]  # + a vendored Node for the `.ps` frontend tooling (uses system Node if present)
```

`@wasm` runs in-process (compiled to WebAssembly) out of the box — the wasm runtime ships in the base
install. Run `pyths doctor` to see what your machine can do (compiler, wasm runtime, Node, adapters).

```python
from pythscribe import wasm

@wasm
def dot(xs: list[float], ys: list[float]) -> float:
    acc = 0.0
    for i in range(len(xs)):
        acc = acc + xs[i] * ys[i]
    return acc
```

```bash
python -m pythscribe.build kernels.py   # compile each @wasm def with `pyths` -> __pythscribe__/<fn>/
```

Without the build step the function is still your function (plain Python). With it, the same call runs
the compiled kernel, and the decorator tells you which path ran:

```python
>>> from pythscribe import binding_of
>>> binding_of(dot).mode          # 'server' | 'browser' | 'fallback'
'server'
```

## Documentation & demos

- **Installation, supported platforms, and the full guide** — see the
  [project README](https://github.com/swetmr/pythscribe#readme) (Installation section).
- **Runnable demos** (Gradio and Streamlit, browser + server) —
  [`demos/`](https://github.com/swetmr/pythscribe/tree/main/demos).
- **Worked examples** (`@wasm` kernels, image preprocessing, typed arrays) —
  [`examples/`](https://github.com/swetmr/pythscribe/tree/main/examples).

## Licence

The pip package is **MIT** (`pythscribe/LICENSE`). The wheel bundles the `pyths` compiler binary
(`pythscribe/_bin/`, FSL-1.1-ALv2), so the wheel's licence expression is
`MIT AND LicenseRef-FSL-1.1-ALv2`; its `.dist-info/licenses/` carries both texts, the vendored runtime's
notice, a per-installed-path map, and the third-party notices of the crates linked into the binary.
Compiled output of your own code is yours.
