bebop / poly

A Go package for engineering organisms.
https://pkg.go.dev/github.com/bebop/poly
MIT License
677 stars 73 forks source link

Make example tests run in browser #213

Closed Koeng101 closed 2 years ago

Koeng101 commented 3 years ago

Currently, examples don't work in browser because we don't embed the /data/ file into our binaries. This is embarrassing for Tim during live demos. We should make em work so that Tim doesn't have to be embarrassed during live demos.

TimothyStiles commented 2 years ago

Embedding won't work for this. I've tried writing our own thing but I kind of need to figure out how to ship a Go interpreter via WASM for this to work properly without secops/billing problems.

sabhiram commented 2 years ago

Maybe of interest: https://github.com/tetratelabs/wazero

TimothyStiles commented 2 years ago

@sabhiram I don't think this quite what is needed but I'm definitely saving for later :D

Essentially I need a JIT compiler for Go as a WASM binary that can be called from a client front end. Go's standard playground is entirely sandboxed and doesn't work with system or network calls so you can't run file IO/API examples.

Since a good portion of Poly is file IO for synbio related formats it'd be really good to have at least some runnable examples there. It'd also make it way easier to write tutorials. Have any ideas here? I've found some similar-ish things.

https://github.com/iafan/goplayspace https://github.com/ccbrown/wasm-go-playground https://github.com/x1unix/go-playground

Unfortunately wasm-go-playground doesn't have instructions for a repeatable build process for their wasm Go compiler and go-playground looks really slick but for some reason uses the backend to compile wasm ૮₍ ˃ ⤙ ˂ ₎ა

If there was a playground that like go-playground that used a stable JIT Go wasm compiler that would be ideal.