Skip to content

Commit

Permalink
Merge pull request #75 from pyscript/2024-4-1
Browse files Browse the repository at this point in the history
Changes for 2024-4-1 release.
  • Loading branch information
ntoll authored Apr 15, 2024
2 parents d51e294 + d9e071a commit e84f499
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
8 changes: 4 additions & 4 deletions docs/beginning-pyscript.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ module in the document's `<head>` tag:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>🦜 Polyglot - Piratical PyScript</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
</head>
<body>

Expand Down Expand Up @@ -157,8 +157,8 @@ In the end, our HTML should look like this:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>🦜 Polyglot - Piratical PyScript</title>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
</head>
<body>
<h1>Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️</h1>
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/dom.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ There are three ways in which JavaScript can get into a web page.
1. As a global reference attached to the `window` object in the web page
because the code was referenced as the source of a `script` tag in your HTML
(the very old school way to do this).
2. Using the [Universal Module Definition](https://github.com/umdjs/umd) (UMD)
- an out-of-date and non-standard way to create JavaScript modules.
2. Using the [Universal Module Definition](https://github.com/umdjs/umd) (UMD),
an out-of-date and non-standard way to create JavaScript modules.
3. As a standard
[JavaScript Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
which is the modern, standards compliant way to define and use a JavaScript
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ CSS:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- PyScript CSS -->
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
<!-- This script tag bootstraps PyScript -->
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
</head>
<body>
<!-- your code goes here... -->
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Here's an example of how a PyScript plugin looks like:

```js
// import the hooks from PyScript first...
import { hooks } from "https://pyscript.net/releases/2024.3.2/core.js";
import { hooks } from "https://pyscript.net/releases/2024.4.1/core.js";

// Use the `main` attribute on hooks do define plugins that run on the main thread
hooks.main.onReady.add((wrap, element) => {
Expand Down
29 changes: 22 additions & 7 deletions docs/user-guide/terminal.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ It usually looks something like this:

Because of the historic importance of the use of a terminal, PyScript makes one
available in the browser (based upon [XTerm.js](https://xtermjs.org/)).
As [mentioned earlier](first-steps.md), PyScript's built-in terminal is activated
with the `terminal` flag when using the `<script>`, `<py-script>` or
As [mentioned earlier](first-steps.md), PyScript's built-in terminal is
activated with the `terminal` flag when using the `<script>`, `<py-script>` or
`<mpy-script>` tags.

!!! danger
!!! success

MicroPython currently doesn't work with the terminal.

Terminal support for MicroPython is coming, just as soon as a new version
of MicroPython is released.
As of the 2024.4.1 release, MicroPython works with the terminal.

This is, perhaps, the simplest use case that allows data to be emitted to a
read-only terminal:
Expand Down Expand Up @@ -59,3 +56,21 @@ code.interact()
The end result should look something like this:

<img src="../../assets/images/pyterm3.gif" style="border: 1px solid black; border-radius: 0.2rem; box-shadow: var(--md-shadow-z1);"/>

Finally, it is possible to dynamically pass Python code into the terminal. The
trick is to get a reference to the terminal created by PyScript. Thankfully,
this is very easy.

Consider this fragment:

```html
<script id="my_script" type="mpy" terminal worker>
```
Get a reference to the element, and just call the `process` method on
that object:
```JS
const myterm = document.querySelector("#my_script");
await myterm.process('print("Hello world!")');
```
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2024.3.2"
"version": "2024.4.1"
}

0 comments on commit e84f499

Please sign in to comment.