<Liminoid />
Like react-live that can run the scientific Python stack... powered by liminoid-js
Installation
$ yarn add liminoid-react
or
$ npm install --save liminoid-react
Usage
For a more comprehensive guide to using the package see the documentation or browse the examples.
// easiest to use ES6 imports from the UNPKG CDN
import Liminoid from 'https://cdn.liminoid.io/liminoid-react/index.js';
//import { Repl } from 'https://cdn.liminoid.io/liminoid-js/index.js';
// import { Repl } from https://cdn.liminoid.io/liminoid-js@x.x.x/index.js
const placeholder = `
from sklearn import svm
from sklearn import datasets
clf = svm.SVC()
X, y = datasets.load_iris(return_X_y=True)
clf.fit(X, y)
clf.predict(X[0:1])
`;
<Liminoid
packages={['scikit-learn']}
console={true}
edit={true}
scope={false}
onResult={res => console.log(res)}
code={placeholder}
/>
props
| name | default | values | description |
|---|---|---|---|
packages |
[] |
Array: package names currently avalable in Pyodide |
Uses Pyodide's loadPackage() to preload packages |
console |
true |
Boolean: true or false |
false disables the HTML console which displays the results. |
edit |
true |
Boolean: true or false |
false disables the textarea input while still allowing the embedded code to be run. |
scope |
false |
Boolean: true or false |
true creates a new Repl() for the component with its own Python context. false shares the Repl() context between editors globally, i.e. one editor can reference variables from another. |
onResult |
undefined |
Function: function expression or reference |
callback function that receives the results when the code is run. (res, err) => { ... } |
code |
undefined |
String or template literal |
placeholder code that populates the editor component on initialization. |
Contributing/Requests
Open an issue or post a message in the chatroom. If you would like to contribute to the project (code, documentation, tutorials, etc.) see the contributing guide for how to get started
Citing
While not required, when using (or extending) Liminoid for academic work, citations are appreciated
@software{liminoid,
author = {Jonathan Dinu},
title = {Liminoid: Web assembly toolkit for building local-first interactive analytics applications},
month = {March},
year = {2020},
version = {0.0.1},
doi = {10.5281/zenodo.3754953},
url = {https://github.com/liminoid},
}
License
All original work licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.