Skip to content

Commit e84f499

Browse files
authored
Merge pull request #75 from pyscript/2024-4-1
Changes for 2024-4-1 release.
2 parents d51e294 + d9e071a commit e84f499

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed

Diff for: docs/beginning-pyscript.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ module in the document's `<head>` tag:
106106
<meta charset="utf-8" />
107107
<meta name="viewport" content="width=device-width,initial-scale=1" />
108108
<title>🦜 Polyglot - Piratical PyScript</title>
109-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
110-
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
109+
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
110+
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
111111
</head>
112112
<body>
113113

@@ -157,8 +157,8 @@ In the end, our HTML should look like this:
157157
<meta charset="utf-8" />
158158
<meta name="viewport" content="width=device-width,initial-scale=1" />
159159
<title>🦜 Polyglot - Piratical PyScript</title>
160-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
161-
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
160+
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
161+
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
162162
</head>
163163
<body>
164164
<h1>Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️</h1>

Diff for: docs/user-guide/dom.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ There are three ways in which JavaScript can get into a web page.
265265
1. As a global reference attached to the `window` object in the web page
266266
because the code was referenced as the source of a `script` tag in your HTML
267267
(the very old school way to do this).
268-
2. Using the [Universal Module Definition](https://github.com/umdjs/umd) (UMD)
269-
- an out-of-date and non-standard way to create JavaScript modules.
268+
2. Using the [Universal Module Definition](https://github.com/umdjs/umd) (UMD),
269+
an out-of-date and non-standard way to create JavaScript modules.
270270
3. As a standard
271271
[JavaScript Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
272272
which is the modern, standards compliant way to define and use a JavaScript

Diff for: docs/user-guide/first-steps.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ CSS:
2020
<meta charset="UTF-8">
2121
<meta name="viewport" content="width=device-width,initial-scale=1.0">
2222
<!-- PyScript CSS -->
23-
<link rel="stylesheet" href="https://pyscript.net/releases/2024.3.2/core.css">
23+
<link rel="stylesheet" href="https://pyscript.net/releases/2024.4.1/core.css">
2424
<!-- This script tag bootstraps PyScript -->
25-
<script type="module" src="https://pyscript.net/releases/2024.3.2/core.js"></script>
25+
<script type="module" src="https://pyscript.net/releases/2024.4.1/core.js"></script>
2626
</head>
2727
<body>
2828
<!-- your code goes here... -->

Diff for: docs/user-guide/plugins.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Here's an example of how a PyScript plugin looks like:
1414

1515
```js
1616
// import the hooks from PyScript first...
17-
import { hooks } from "https://pyscript.net/releases/2024.3.2/core.js";
17+
import { hooks } from "https://pyscript.net/releases/2024.4.1/core.js";
1818

1919
// Use the `main` attribute on hooks do define plugins that run on the main thread
2020
hooks.main.onReady.add((wrap, element) => {

Diff for: docs/user-guide/terminal.md

+22-7
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ It usually looks something like this:
1212

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

19-
!!! danger
19+
!!! success
2020

21-
MicroPython currently doesn't work with the terminal.
22-
23-
Terminal support for MicroPython is coming, just as soon as a new version
24-
of MicroPython is released.
21+
As of the 2024.4.1 release, MicroPython works with the terminal.
2522

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

6158
<img src="../../assets/images/pyterm3.gif" style="border: 1px solid black; border-radius: 0.2rem; box-shadow: var(--md-shadow-z1);"/>
59+
60+
Finally, it is possible to dynamically pass Python code into the terminal. The
61+
trick is to get a reference to the terminal created by PyScript. Thankfully,
62+
this is very easy.
63+
64+
Consider this fragment:
65+
66+
```html
67+
<script id="my_script" type="mpy" terminal worker>
68+
```
69+
70+
Get a reference to the element, and just call the `process` method on
71+
that object:
72+
73+
```JS
74+
const myterm = document.querySelector("#my_script");
75+
await myterm.process('print("Hello world!")');
76+
```

Diff for: version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "2024.3.2"
2+
"version": "2024.4.1"
33
}

0 commit comments

Comments
 (0)