-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from pyscript/2023-12-1
2023.12.1 documentation changes
- Loading branch information
Showing
16 changed files
with
193 additions
and
30 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Python editor | ||
|
||
The PyEditor is a core plugin. | ||
|
||
!!! warning | ||
|
||
Work on the Python editor is in its early stages. We have made it available | ||
in this version of PyScript to give the community an opportunity to play, | ||
experiment and provide feedback. | ||
|
||
Future versions of PyScript will include a more refined, robust and perhaps | ||
differently behaving version of the Python editor. | ||
|
||
If you specify the type of a `<script>` tag as either `py-editor` (for Pyodide) | ||
or `mpy-editor` (for MicroPython), the plugin creates a visual code editor, | ||
with code highlighting and a "run" button to execute the editable code | ||
contained therein in a non-blocking worker. | ||
|
||
The interpreter is not loaded onto the page until the run button is clicked. By | ||
default each editor has its own independent instance of the specified | ||
interpreter: | ||
|
||
```html title="Two editors, one with Pyodide, the other with MicroPython." | ||
<script type="py-editor"> | ||
import sys | ||
print(sys.version) | ||
</script> | ||
<script type="mpy-editor"> | ||
import sys | ||
print(sys.version) | ||
a = 42 | ||
print(a) | ||
</script> | ||
``` | ||
|
||
However, different editors can share the same interpreter if they share the | ||
same `env` attribute value. | ||
|
||
```html title="Two editors sharing the same MicroPython environment." | ||
<script type="mpy-editor" env="shared"> | ||
if not 'a' in globals(): | ||
a = 1 | ||
else: | ||
a += 1 | ||
print(a) | ||
</script> | ||
<script type="mpy-editor" env="shared"> | ||
# doubled a | ||
print(a * 2) | ||
</script> | ||
``` | ||
|
||
The outcome of these code fragments should look something like this: | ||
|
||
<img src="../../assets/images/pyeditor1.gif" style="border: 1px solid black; border-radius: 0.2rem; box-shadow: var(--md-shadow-z1);"/> | ||
|
||
!!! info | ||
|
||
Notice that the interpreter type, and optional environment name is shown | ||
at the top right above the Python editor. | ||
|
||
Hovering over the Python editor reveals the "run" button. | ||
|
||
Finally, the `target` attribute allows you to specify a node into which the | ||
editor will be rendered: | ||
|
||
```html title="Specify a target for the Python editor." | ||
<script type="mpy-editor" target="editor"> | ||
import sys | ||
print(sys.version) | ||
</script> | ||
<div id="editor"></div> <!-- will eventually contain the Python editor --> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# Example applications | ||
|
||
** TODO: fill this with references and descriptions to examples on PyScript.com ** | ||
A curated list of example applications that demonstrate various features of | ||
PyScript can be found [on PyScript.com](https://pyscript.com/@examples). | ||
|
||
The examples are (links take you to the code): | ||
|
||
* [Hello world](https://pyscript.com/@examples/hello-world/latest) | ||
* [A simple clock](https://pyscript.com/@examples/simple-clock/latest) | ||
* [Simple slider panel](https://pyscript.com/@examples/simple-panel/latest) | ||
* [Streaming data panel](https://pyscript.com/@examples/streaming-in-panel/latest) | ||
* [WebGL Icosahedron](https://pyscript.com/@examples/webgl-icosahedron/latest) | ||
* [KMeans in a panel](https://pyscript.com/@examples/kmeans-in-panel/latest) | ||
* [New York Taxi panel (WebGL)](https://pyscript.com/@examples/nyc-taxi-panel-deckgl/latest) | ||
* [Pandas dataframe fun](https://pyscript.com/@examples/pandas/latest) | ||
* [Matplotlib example](https://pyscript.com/@examples/matplotlib/latest) | ||
* [Numpy fractals](https://pyscript.com/@examples/fractals-with-numpy-and-canvas/latest) | ||
* [Folium geographical data](https://pyscript.com/@examples/folium/latest) | ||
* [Bokeh data plotting](https://pyscript.com/@examples/bokeh/latest) | ||
* [Import antigravity](https://pyscript.com/@examples/antigravity/latest) | ||
* [Altair data plotting](https://pyscript.com/@examples/altair/latest) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "2023.11.2" | ||
"version": "2023.12.1" | ||
} |