kosa8 docs

Commands / kosa8 cloud code

kosa8 cloud code

Run Python in a stateful interpreter in a cloud sandbox; charts come back as images

Usage

kosa8 cloud code ID [CODE]

Runs a Python cell in a context whose globals last between calls (like a notebook). The code is the argument, else --file, else stdin. Charts (matplotlib) come back as PNGs, saved with --save DIR. It needs a persistent sandbox: kosa8 cloud sandbox create --persistent.

Options

FlagTypeWhat it doesDefault
--contextstringthe context to run in (default: default)—
-f, --filestringread the code from this file—
--savestringsave returned images (charts) into this folder—
--timeoutdurationstop the cell after this long1m0s

Example

  kosa8 cloud code sbx_abc 'x = 21'
  kosa8 cloud code sbx_abc 'print(x * 2)'
  kosa8 cloud code sbx_abc -f plot.py --save ./charts
  kosa8 cloud code contexts sbx_abc

Subcommands