Coldbrew is installed on this page through https://cdn.jsdelivr.net/gh/plasticityai/coldbrew@0.0.74/dist/coldbrew.js
.
Open the browser console and try running some of these examples in the console.
Start by loading Coldbrew with:
Coldbrew.load().then(function() { console.log("Finished loading Coldbrew!") });
Once loaded, you can interact with Python. For example, to print the version of Python run the following in the browser console:
Coldbrew.run("import sys");
Coldbrew.run("print('The current Python version is:', sys.version)");
You can also issue multiple commands in the same function call, to see this, run the following in the browser console:
Coldbrew.run(["x = [i for i in range(10)]","print(x)"].join("\n"));
You can run a Python file like add.py with arguments and environment variables specified, to see this, run the following in the browser console:
Coldbrew.runFile('add.py', {cwd:'/coldbrew/examples', env:{}, args:['5', '15', '-v']});
See more documentation on GitHub
for more information on interacting with the virtual filesystem, installing modules, interacting with the environment, running Python asynchronously, communicating bi-directionally between the two languages, building a custom Coldbrew Python environment, and more.