Commit b6a348930a

b6a348930a231ab1ffd793a69f2d512f8b60bad8

parent: de2aded768

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-27 23:41 UTC

Manual: python blocks in Pyodide reach the network

Closes #249

Layout: unified · split

Changed files (3)
docs/manual/guide/11-code-blocks.org +2 −1 · view
@@ -133,7 +133,8 @@ In the Mac App Store version and on iOS, =python= blocks run in Pyodide 314.0.8,
133 133
134What differs from =python3=: 134What differs from =python3=:
135 135
136- Only the standard library is there. =numpy=, =matplotlib= and other packages are not, and can't be installed: =import numpy= fails with =ModuleNotFoundError=. A block with =:results graphics= fails with "Python blocks can't draw graphics in this version of orgstar: matplotlib isn't included." A =:file= result that is the block's value or output is written as for any other language. 136- Only the standard library is there. =numpy=, =matplotlib= and other packages are not, and orgstar doesn't install them: =import numpy= fails with =ModuleNotFoundError=. Loading a package from the network with =pyodide_js.loadPackage= and its URL works, but isn't supported. A block with =:results graphics= fails with "Python blocks can't draw graphics in this version of orgstar: matplotlib isn't included." A =:file= result that is the block's value or output is written as for any other language.
137- The block can reach the network, as a web page can: =urllib.request=, =js.fetch= and =pyodide.http= work.
137- The block can't see your files or start programs. It runs in Pyodide's own file system, in =/home/pyodide=, and files it writes there are not kept. =:dir= must name a folder that exists, but the block doesn't run in it. =input()= reads nothing. 138- The block can't see your files or start programs. It runs in Pyodide's own file system, in =/home/pyodide=, and files it writes there are not kept. =:dir= must name a folder that exists, but the block doesn't run in it. =input()= reads nothing.
138- =:python= is ignored. 139- =:python= is ignored.
139- Every block runs in one interpreter. A block without a session gets its own variables, but modules it imports stay loaded, with any changes it made to them, until Pyodide is unloaded. A session keeps its variables until then too. 140- Every block runs in one interpreter. A block without a session gets its own variables, but modules it imports stay loaded, with any changes it made to them, until Pyodide is unloaded. A session keeps its variables until then too.
docs/manual/guide/14-ios.org +2 · view
@@ -452,6 +452,8 @@ On iOS, only Emacs Lisp, JavaScript, Python, calc, sqlite, dot and mermaid block
452- Python with =:results graphics=: "Python blocks can't draw graphics in this version of orgstar: matplotlib isn't included." 452- Python with =:results graphics=: "Python blocks can't draw graphics in this version of orgstar: matplotlib isn't included."
453- A calc or sqlite block orgstar can't run as Emacs would: "This calc block can't be calculated here: /reason/." or "This sqlite block can't run here: /reason/." 453- A calc or sqlite block orgstar can't run as Emacs would: "This calc block can't be calculated here: /reason/." or "This sqlite block can't run here: /reason/."
454 454
455Python blocks can reach the network: =urllib.request=, =js.fetch= and =pyodide.http= work. Only the standard library is built in; loading a package from the network with =pyodide_js.loadPackage= and its URL works, but isn't supported.
456
455Table formulas that orgstar computes itself work on iOS. In a table whose formulas need Emacs, orgstar applies the formulas up to the first one that needs it and stops there, as Emacs does when a formula fails: the fields written before it stay and the rest are unchanged. The message is "The table was recalculated up to /formula/, which needs Emacs on the Mac", with the formula's left-hand side and the reason. When nothing was written, it is "This table needs Emacs, which runs on the Mac", with the reason, and the table is unchanged. 457Table formulas that orgstar computes itself work on iOS. In a table whose formulas need Emacs, orgstar applies the formulas up to the first one that needs it and stops there, as Emacs does when a formula fails: the fields written before it stay and the rest are unchanged. The message is "The table was recalculated up to /formula/, which needs Emacs on the Mac", with the formula's left-hand side and the reason. When nothing was written, it is "This table needs Emacs, which runs on the Mac", with the reason, and the table is unchanged.
456 458
457Tangling (=C-c C-v t=, in Commands) works on iOS and writes the tangled files next to the org file, or where =:tangle= says. 459Tangling (=C-c C-v t=, in Commands) works on iOS and writes the tangled files next to the org file, or where =:tangle= says.
docs/manual/install.org +1 −1 · view
@@ -77,7 +77,7 @@ A block in another language reports "/language/ blocks don't run in this version
77orgstar." An Emacs Lisp block that uses more than the interpreter has reports "This block uses 77orgstar." An Emacs Lisp block that uses more than the interpreter has reports "This block uses
78Emacs Lisp that runs only in Emacs." A JavaScript block that uses something only node has 78Emacs Lisp that runs only in Emacs." A JavaScript block that uses something only node has
79reports "This block uses /name/, which runs only in node." A Python block runs in Pyodide, with 79reports "This block uses /name/, which runs only in node." A Python block runs in Pyodide, with
80the standard library only. A table whose formulas need Emacs is recalculated up to 80the standard library only, and can reach the network. A table whose formulas need Emacs is recalculated up to
81the first formula that needs it, which the message names with the reason; the fields 81the first formula that needs it, which the message names with the reason; the fields
82before it stay and the rest are unchanged. The Emacs exports are 82before it stay and the rest are unchanged. The Emacs exports are
83not in the File ▸ Export menu, the export dialog or the command palette; a key bound to 83not in the File ▸ Export menu, the export dialog or the command palette; a key bound to
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form