summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-05-31 11:45:34 +1000
committerDamien George <damien@micropython.org>2024-03-22 14:31:25 +1100
commitb9eb74e73b8ad7be7c3d3d2eca2b1755041f03e6 (patch)
tree096a444c43aeee0de02186ed81abeac314c36aa1
parent6ff3e356e2cef310ea5e6481d60163a8138c3d66 (diff)
webassembly/variants/pyscript: Add pyscript variant.
This commit adds a pyscript variant for use in https://pyscript.net/. The configuration is: - No ASYNCIFY, in order to keep the WASM size down and have good performance. - MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES to enable most features. - Custom manifest that includes many of the python-stdlib libraries. - MICROPY_GC_SPLIT_HEAP_AUTO to increase GC heap size instead of doing a collection when memory is exhausted. This is needed because ASYNCIFY is disabled. Instead the GC collection is run at the top-level before executing any Python code. - No MICROPY_VARIANT_ENABLE_JS_HOOK because there is no asynchronous keyboard input to interrupt a running script. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/webassembly/variants/pyscript/manifest.py27
-rw-r--r--ports/webassembly/variants/pyscript/mpconfigvariant.h3
-rw-r--r--ports/webassembly/variants/pyscript/mpconfigvariant.mk3
3 files changed, 33 insertions, 0 deletions
diff --git a/ports/webassembly/variants/pyscript/manifest.py b/ports/webassembly/variants/pyscript/manifest.py
new file mode 100644
index 000000000..0646e1d89
--- /dev/null
+++ b/ports/webassembly/variants/pyscript/manifest.py
@@ -0,0 +1,27 @@
+require("abc")
+require("base64")
+require("collections")
+require("collections-defaultdict")
+require("copy")
+require("datetime")
+require("fnmatch")
+require("functools")
+require("gzip")
+require("hmac")
+require("html")
+require("inspect")
+require("io")
+require("itertools")
+require("locale")
+require("logging")
+require("operator")
+require("os")
+require("os-path")
+require("pathlib")
+require("stat")
+require("tarfile")
+require("tarfile-write")
+require("time")
+require("unittest")
+require("uu")
+require("zlib")
diff --git a/ports/webassembly/variants/pyscript/mpconfigvariant.h b/ports/webassembly/variants/pyscript/mpconfigvariant.h
new file mode 100644
index 000000000..ed8e81280
--- /dev/null
+++ b/ports/webassembly/variants/pyscript/mpconfigvariant.h
@@ -0,0 +1,3 @@
+#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES)
+#define MICROPY_GC_SPLIT_HEAP (1)
+#define MICROPY_GC_SPLIT_HEAP_AUTO (1)
diff --git a/ports/webassembly/variants/pyscript/mpconfigvariant.mk b/ports/webassembly/variants/pyscript/mpconfigvariant.mk
new file mode 100644
index 000000000..016b96a99
--- /dev/null
+++ b/ports/webassembly/variants/pyscript/mpconfigvariant.mk
@@ -0,0 +1,3 @@
+JSFLAGS += -s ALLOW_MEMORY_GROWTH
+
+FROZEN_MANIFEST ?= variants/pyscript/manifest.py