From 48a0db8dce8ecd3317edbef7027ca9ba2a0299b8 Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Tue, 1 Jul 2025 12:28:17 +0100 Subject: [PATCH 1/3] Bump version. --- docs/beginning-pyscript.md | 8 ++++---- docs/user-guide/first-steps.md | 4 ++-- docs/user-guide/plugins.md | 10 +++++----- docs/user-guide/pygame-ce.md | 4 ++-- docs/user-guide/workers.md | 4 ++-- version.json | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/beginning-pyscript.md b/docs/beginning-pyscript.md index e0d5e67..9f9fc65 100644 --- a/docs/beginning-pyscript.md +++ b/docs/beginning-pyscript.md @@ -117,8 +117,8 @@ module in the document's `` tag: 🦜 Polyglot - Piratical PyScript - - + + @@ -168,8 +168,8 @@ In the end, our HTML should look like this: 🦜 Polyglot - Piratical PyScript - - + +

Polyglot 🦜 💬 🇬🇧 ➡️ 🏴‍☠️

diff --git a/docs/user-guide/first-steps.md b/docs/user-guide/first-steps.md index b5ed91b..9210c26 100644 --- a/docs/user-guide/first-steps.md +++ b/docs/user-guide/first-steps.md @@ -20,9 +20,9 @@ CSS: - + - + diff --git a/docs/user-guide/plugins.md b/docs/user-guide/plugins.md index 3463118..4dc0c6d 100644 --- a/docs/user-guide/plugins.md +++ b/docs/user-guide/plugins.md @@ -100,7 +100,7 @@ For example, this will work because all references are contained within the registered function: ```js -import { hooks } from "https://pyscript.net/releases/2025.5.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.7.1/core.js"; hooks.worker.onReady.add(() => { // NOT suggested, just an example! @@ -114,7 +114,7 @@ hooks.worker.onReady.add(() => { However, due to the outer reference to the variable `i`, this will fail: ```js -import { hooks } from "https://pyscript.net/releases/2025.5.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.7.1/core.js"; // NO NO NO NO NO! ☠️ let i = 0; @@ -147,7 +147,7 @@ the page. ```js title="log.js - a plugin that simply logs to the console." // import the hooks from PyScript first... -import { hooks } from "https://pyscript.net/releases/2025.5.1/core.js"; +import { hooks } from "https://pyscript.net/releases/2025.7.1/core.js"; // The `hooks.main` attribute defines plugins that run on the main thread. hooks.main.onReady.add((wrap, element) => { @@ -197,8 +197,8 @@ hooks.worker.onAfterRun.add(() => { - - + + + + diff --git a/docs/user-guide/workers.md b/docs/user-guide/workers.md index 9e2cc16..d439cd5 100644 --- a/docs/user-guide/workers.md +++ b/docs/user-guide/workers.md @@ -282,9 +282,9 @@ Here's how: - + - + PyWorker - mpy bootstrapping pyodide example diff --git a/version.json b/version.json index 4191267..ddd025c 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2025.5.1" + "version": "2025.7.1" } From 7fc8c8ac975c6f8a3fda3576c754b95767a77f54 Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Tue, 1 Jul 2025 12:52:01 +0100 Subject: [PATCH 2/3] Update configuration as discussed. --- docs/user-guide/configuration.md | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index ba2d14c..5a0fdb7 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -318,6 +318,22 @@ following valid forms: * An arbitrary URL to a Python package: `"https://.../package.whl"` * A file copied onto the browser based file system: `"emfs://.../package.whl"` +#### Package Cache + +For performance reasons, PyScript caches packages so that a delay resulting +from downloading the packages is only noticable on first load - after which, +PyScript will fall back on packages previously downloaded and held in the +browser's local cache. + +The behaviour of caching can be configured via the `packages_cache` setting. If +this setting is not used, PyScript will cache packages. Otherwise, override +PyScript's behaviour by setting `packages_cache` to one of these two values: + +* `never` - PyScript will not cache packages. +* `passthrough` - this only works with Pyodide (see [this wiki](https://deepwiki.com/cloudflare/pyodide/3-package-system)), + and will cause Pyodide to download packages in a parallel manner rather than + the default linear fashion. However, these packages will not be cached. + ### Plugins The `plugins` option allows user to either augment, or exclude, the list of @@ -518,6 +534,28 @@ experimental_create_proxy = "auto" [raise an issue](https://github.com/pyscript/pyscript/issues) with a reproducable example, and we'll investigate. +### experimental_ffi_timeout + +When bootstrapping a worker, the worker is told to use a cache for round-trip +operations (for example, `my_object.foo.bar.baz` causes a round-trip to the +main thread for each dot `.` in this chain of references). By caching the +dotted references performance can be improved by reducing the number of +round trips PyScript makes. + +However, not everything can be cached (those APIs or objects with side-effects +won't work; for example DOM element based APIs etc). + +The `experimental_ffi_timeout` setting defines the maximum lifetime of that +cache. If it's less than 0 (the default), there is no cache whatsoever. Zero +means to clean up the cache on the next iteration of the event loop. A positive +number is the maximum number of milliseconds the cache will be kept alive. + +### debug + +When using Pyodide, if the `debug` setting is set to `true`, then Pyodide will +run in debug mode. See Pyodide's documentation for details of what this +entails. + ### Custom Sometimes plugins or apps need bespoke configuration options. From f2c59293e977b25c60ac603eddf22e5db05ff843 Mon Sep 17 00:00:00 2001 From: "Nicholas H.Tollervey" Date: Tue, 1 Jul 2025 13:40:16 +0100 Subject: [PATCH 3/3] Fix nits. --- docs/user-guide/configuration.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index 5a0fdb7..ea69be2 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -537,8 +537,8 @@ experimental_create_proxy = "auto" ### experimental_ffi_timeout When bootstrapping a worker, the worker is told to use a cache for round-trip -operations (for example, `my_object.foo.bar.baz` causes a round-trip to the -main thread for each dot `.` in this chain of references). By caching the +operations (for example, `window.my_object.foo.bar.baz` causes a round-trip to +the main thread for each dot `.` in this chain of references). By caching the dotted references performance can be improved by reducing the number of round trips PyScript makes. @@ -550,6 +550,10 @@ cache. If it's less than 0 (the default), there is no cache whatsoever. Zero means to clean up the cache on the next iteration of the event loop. A positive number is the maximum number of milliseconds the cache will be kept alive. +In this experimental phase, we suggest trying `0`, `30` or a value that won't +likely bypass the browser rendering of 60fps. Of course, `1000` (i.e. a second) +would be a fun, if greedy, experiment. + ### debug When using Pyodide, if the `debug` setting is set to `true`, then Pyodide will