Skip to content

Commit 0e6fd33

Browse files
authored
Merge pull request #200 from pyscript/2025-11-2
Bump version to 2025.11.2
2 parents a6b54b4 + 51e3d67 commit 0e6fd33

File tree

9 files changed

+114
-16
lines changed

9 files changed

+114
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ bin
55
lib
66
lib64
77
pyvenv.cfg
8+
*.swp

docs/api.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,61 @@ PyWorker("worker.py", type="micropython")
11001100
<div id="output"></div> <!-- The display target -->
11011101
```
11021102
1103+
!!! info
1104+
1105+
Sometimes code running on a worker gets stuck in an infinite loop and
1106+
becomes unresponsive. There are many complicated reasons why this might
1107+
happen, but when it does happen you likely want to break out of this
1108+
loop. This is where the `isStuck` and `notStuck` features come into play.
1109+
1110+
If you have code in the worker that could end up in an unresponsive
1111+
infinite loop, for example:
1112+
1113+
```python
1114+
import time
1115+
1116+
while True:
1117+
time.sleep(1)
1118+
print("Stuck in a loop")
1119+
```
1120+
1121+
...then you only need wrap this code in the worker like this:
1122+
1123+
```python
1124+
import time
1125+
from pyscript import sync
1126+
is_stuck = sync.isStuck
1127+
break_loop = sync.notStuck
1128+
1129+
def is_not_stuck(condition):
1130+
if not condition and is_stuck():
1131+
# this is a must to reset the "stuck" state
1132+
break_loop()
1133+
# throw an error to get out of the loop
1134+
raise RuntimeError('Worker was stuck, but now it is unstuck')
1135+
return condition
1136+
1137+
while is_not_stuck(True):
1138+
time.sleep(1)
1139+
print("Stuck in a loop")
1140+
```
1141+
1142+
From your code on the main thread you may have something like this:
1143+
1144+
```python
1145+
from pyscript import PyWorker
1146+
1147+
w = PyWorker("sticky_code.py", type="micropython")
1148+
1149+
@when("click", "unstick_button")
1150+
def handle_unstick():
1151+
w.unstuck()
1152+
```
1153+
1154+
This starts the worker with you code that could get into an infinite loop,
1155+
then defines a function that calls the `unstuck()` function on the worker
1156+
when a button on the UI is clicked.
1157+
11031158
### `pyscript.workers`
11041159
11051160
The `pyscript.workers` reference allows Python code in the main thread to

docs/beginning-pyscript.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ module in the document's `<head>` tag:
117117
<meta charset="utf-8" />
118118
<meta name="viewport" content="width=device-width,initial-scale=1" />
119119
<title>🦜 Polyglot - Piratical PyScript</title>
120-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.1/core.css">
121-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
120+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
121+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
122122
</head>
123123
<body>
124124

@@ -168,8 +168,8 @@ In the end, our HTML should look like this:
168168
<meta charset="utf-8" />
169169
<meta name="viewport" content="width=device-width,initial-scale=1" />
170170
<title>🦜 Polyglot - Piratical PyScript</title>
171-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.1/core.css">
172-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
171+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
172+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
173173
</head>
174174
<body>
175175
<h1>Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️</h1>
@@ -231,6 +231,41 @@ points to the `div` element with the id "output". Finally, we assign the
231231

232232
That's it!
233233

234+
## Editing you app
235+
236+
If you use an IDE (like VSCode or PyCharm) then you'll probably want them to
237+
auto-suggest and introspect aspects of the Python code you're writing. The
238+
problem is that the `pyscript` namespace *we provide* isn't installed anywhere
239+
(because it's in your browser, not your IDE's context) so such information
240+
isn't, by default, picked up.
241+
242+
Thankfully Python stubs come to the rescue.
243+
244+
Members of our community have
245+
[created Python stub files for PyScript](https://github.com/pyscript/pyscript-stubs).
246+
You should clone the linked-to repository and configure your IDE to consume the
247+
stub files.
248+
249+
For example, let's say you
250+
[cloned the repository](https://github.com/pyscript/pyscript-stubs) into:
251+
`~/src/stubs/pyscript-stubs`, then in VSCode, you'd create, in your PyScript
252+
project, a file called `.vscode/settings.json` and add the following:
253+
254+
```js
255+
{
256+
"python.analysis.stubPath": "~/src/stubs/pyscript-stubs/src/pyscript-stubs"
257+
}
258+
```
259+
260+
Then restart the Python language server in VSCode (Press `Ctrl+Shift+P` (or
261+
`Cmd+Shift+P` on Mac) to open the Command Palette and type:
262+
`Python: Restart Language Server`.
263+
264+
!!! note
265+
266+
The stubs themselves are found within the `src/pyscript-stubs` directory
267+
in the git repository, hence the longer path in the configuration file.
268+
234269
## Sharing your app
235270

236271
### PyScript.com
@@ -263,6 +298,12 @@ To run PyScript offline, without the need of a CDN or internet connection, read
263298
the [Run PyScript Offline](user-guide/offline.md) section of the user
264299
guide.
265300

301+
We also provide an `offline.zip` file with
302+
[each release](https://pyscript.net/releases/2025.11.2/). This file contains
303+
everything you need for an offline version of PyScript: PyScript itself,
304+
versions of Pyodide and MicroPython, and an index.html page from which you
305+
could create your offline-first PyScript work.
306+
266307
## Conclusion
267308

268309
Congratulations!

docs/user-guide/first-steps.md

Lines changed: 2 additions & 2 deletions
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/2025.11.1/core.css">
23+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
2424
<!-- This script tag bootstraps PyScript -->
25-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
25+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
2626
</head>
2727
<body>
2828
<!-- your code goes here... -->

docs/user-guide/plugins.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ For example, this will work because all references are contained within the
100100
registered function:
101101

102102
```js
103-
import { hooks } from "https://pyscript.net/releases/2025.11.1/core.js";
103+
import { hooks } from "https://pyscript.net/releases/2025.11.2/core.js";
104104

105105
hooks.worker.onReady.add(() => {
106106
// NOT suggested, just an example!
@@ -114,7 +114,7 @@ hooks.worker.onReady.add(() => {
114114
However, due to the outer reference to the variable `i`, this will fail:
115115

116116
```js
117-
import { hooks } from "https://pyscript.net/releases/2025.11.1/core.js";
117+
import { hooks } from "https://pyscript.net/releases/2025.11.2/core.js";
118118

119119
// NO NO NO NO NO! ☠️
120120
let i = 0;
@@ -147,7 +147,7 @@ the page.
147147

148148
```js title="log.js - a plugin that simply logs to the console."
149149
// import the hooks from PyScript first...
150-
import { hooks } from "https://pyscript.net/releases/2025.11.1/core.js";
150+
import { hooks } from "https://pyscript.net/releases/2025.11.2/core.js";
151151

152152
// The `hooks.main` attribute defines plugins that run on the main thread.
153153
hooks.main.onReady.add((wrap, element) => {
@@ -197,8 +197,8 @@ hooks.worker.onAfterRun.add(() => {
197197
<!-- JS plugins should be available before PyScript bootstraps -->
198198
<script type="module" src="./log.js"></script>
199199
<!-- PyScript -->
200-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.1/core.css">
201-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
200+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
201+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
202202
</head>
203203
<body>
204204
<script type="mpy">

docs/user-guide/pygame-ce.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ will be placed. Make sure to update the pyscript release to the latest version.
106106
<title>PyScript Pygame-CE Quickstart</title>
107107
<meta charset="UTF-8">
108108
<meta name="viewport" content="width=device-width,initial-scale=1.0">
109-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.1/core.css">
110-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
109+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
110+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
111111
</head>
112112
<body>
113113
<canvas id="canvas" style="image-rendering: pixelated"></canvas>

docs/user-guide/workers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ Here's how:
286286
<meta charset="utf-8">
287287
<meta name="viewport" content="width=device-width,initial-scale=1">
288288
<!-- PyScript CSS -->
289-
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.1/core.css">
289+
<link rel="stylesheet" href="https://pyscript.net/releases/2025.11.2/core.css">
290290
<!-- This script tag bootstraps PyScript -->
291-
<script type="module" src="https://pyscript.net/releases/2025.11.1/core.js"></script>
291+
<script type="module" src="https://pyscript.net/releases/2025.11.2/core.js"></script>
292292
<title>PyWorker - mpy bootstrapping pyodide example</title>
293293
<script type="mpy" src="main.py"></script>
294294
</head>

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mkdocs-material==9.3.1
22
mike==1.1.2
3+
setuptools

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "2025.11.1"
2+
"version": "2025.11.2"
33
}

0 commit comments

Comments
 (0)