You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.md
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -417,6 +417,33 @@ store = await storage("my-data-store", storage_class=MyStorage)
417
417
# The store object is now an instance of MyStorage.
418
418
```
419
419
420
+
### `@pyscript/core/donkey`
421
+
422
+
Meant as *JS* related imports, you can `import { donkey } from '@pyscript/core/dist/core.js'` and automatically have both *pyscript* module running on your page and a utility to bootstrap a terminal based worker that could evaluate any Python code you need to.
process, // process(code) directly (code visible on the terminal)
429
+
execute, // execute(statement) in Python exec way
430
+
evaluate, // evaluate(expression) in Python eval way
431
+
clear, // clear() the terminal
432
+
reset, // reset() the terminal (including colors)
433
+
kill, // kill() the worker forever
434
+
} =donkey({
435
+
type:'py'||'mpy', // the donkey interpreter to run
436
+
persistent:false, // use `true` to track globals and locals
437
+
terminal:'', // optionally set a target terminal container
438
+
config: {}, // the worker config (packages, files, etc.)
439
+
});
440
+
```
441
+
442
+
About the **terminal** option, please note by default *PyScript* would create a target for that, so that if you don't want it visible on your page you can point to a *CSS* addressable container that is not visible (that is: a `#target` element that has a `display: none` as *CSS* property).
443
+
444
+
With this primitive, and without even bothering with specialized *PyScript* tags, we hope anyone can try out of the box what is that *PyScript* enables on the Web!
445
+
446
+
420
447
### `@pyscript/core/dist/storage.js`
421
448
422
449
The equivalent functionality based on the *JS* module can be found through our module.
0 commit comments