@@ -417,6 +417,42 @@ store = await storage("my-data-store", storage_class=MyStorage)
417417# The store object is now an instance of MyStorage.
418418```
419419
420+ ### ` @pyscript/core/donkey `
421+
422+ Sometimes you need a Python worker ready and waiting to evaluate any code on
423+ your behalf. This is the concept behind the JavaScript "donkey". We couldn't
424+ think of a better way than "donkey" to describe something that is easy to
425+ understand and shoulders the burden without complaint. This feature
426+ means you're able to use PyScript without resorting to specialised
427+ ` <script type="py"> ` style tags. It's just vanilla JavaScript.
428+
429+ Simply ` import { donkey } from '@pyscript/core/dist/core.js' ` and automatically
430+ have both a * pyscript* module running on your page and a utility to bootstrap a
431+ terminal based worker to evaluate any Python code as and when needed in the
432+ future.
433+
434+ ``` js title="A donkey worker"
435+ import { donkey } from ' @pyscript/core/dist/core.js' ;
436+
437+ const {
438+ process , // process(code) code (visible in the terminal)
439+ execute, // execute(statement) in Python exec way
440+ evaluate, // evaluate(expression) in Python eval way
441+ clear, // clear() the terminal
442+ reset, // reset() the terminal (including colors)
443+ kill, // kill() the worker forever
444+ } = donkey ({
445+ type: ' py' || ' mpy' , // the Python interpreter to run
446+ persistent: false , // use `true` to track globals and locals
447+ terminal: ' ' , // optionally set a target terminal container
448+ config: {}, // the worker config (packages, files, etc.)
449+ });
450+ ```
451+
452+ By default PyScript creates a target terminal. If you don't want a terminal to
453+ appear on your page, use the ` terminal ` option to point to a CSS addressable
454+ container that is not visible (i.e. the target has ` display: none ` ).
455+
420456### ` @pyscript/core/dist/storage.js `
421457
422458The equivalent functionality based on the * JS* module can be found through our module.
0 commit comments