# unplugin-pyscript-script

> PyScript Script plugin for unplugin

Latest version **1.0.0** (published 2022-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install unplugin-pyscript-script
pnpm add unplugin-pyscript-script
yarn add unplugin-pyscript-script
bun add unplugin-pyscript-script
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-08-07 |
| First published | 2022-08-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Herbert He |
| Maintainers | herberthe |
| Keywords | Unplugin, PyScript, Vite, Webpack, Rollup |

## Links

- npm: https://www.npmjs.com/package/unplugin-pyscript-script
- npm.io page: https://npm.io/package/unplugin-pyscript-script

## Dependencies (1)

- [unplugin](https://npm.io/package/unplugin.md) ^0.9.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-08-07

## README

# unplugin-pyscript-script

`unplugin-pyscript-script` is the plugin for [PyScript](https://pyscript.net/) script importing. When you are using PyScript with Vite, Webpack, Rollup..., it would be useful.

About PyScript, see [PyScript](https://pyscript.net/).

## Usage

About how to use the plugin for Vite, Webpack, Rollup..., see [UnPlugin](https://github.com/unjs/unplugin)

### Write your PyScript code to file with `.script.py` suffix

```python
print("Let's compute π:")
def compute_pi(n):
    pi = 2
    for i in range(1,n):
        pi *= 4 * i ** 2 / (4 * i ** 2 - 1)
    return pi

pi = compute_pi(100000)
s = f"π is approximately {pi:.3f}"
print(s)
```

- `<py-script output="output-id"></py-script>`

```python
# output= "output-id"

import matplotlib.pyplot as plt
import numpy as np

x = np.random.randn(1000)
y = np.random.randn(1000)

fig, ax = plt.subplots()
ax.scatter(x, y)
fig
```

### Import your `.script.py` file to js

```js
import { script } from "./xxx.script.py"
```

---
_Source: https://npm.io/package/unplugin-pyscript-script · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
