From 997604193cf3ce2caabf9426c89bff84dea504d6 Mon Sep 17 00:00:00 2001 From: Albert DeFusco Date: Fri, 29 Apr 2022 18:53:41 -0500 Subject: [PATCH] py-env --- GETTING-STARTED.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md index e6a9b877..16721b0d 100644 --- a/GETTING-STARTED.md +++ b/GETTING-STARTED.md @@ -111,6 +111,42 @@ pyscript.write('pi', f'π is approximately {pi:.3f}') ``` +## Packages and modules + +In addition to the [Python Standard Library](https://docs.python.org/3/library/) and +the `pyscript` module, many 3rd-party OSS packages will work out-of-the-box with PyScript. +In order to use them you will need to delcare the dependencies using the `` in the +HTML head. + +For example, NumPy and Matplotlib are available. Notice here we're using `` +as a shortcut, which takes the expression on the last line of the script and runs `pyscript.write('plot', fig)`. -## Asynchronous \ No newline at end of file +```html + + + + + + - numpy + - matplotlib + + + + +

Let's plot random numbers

+
+ +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 + + + +``` \ No newline at end of file