pybros Svelte Themes

Pybros

Collaborative python programming without the server. Demos svelte + wasm usage.

(WIP) pybros

šŸ‘‹ This is very much a work in progress. Knowing me, I will probably start working on another side project and forget about this before long šŸ¤·ā€ā™‚ļø. (I have a bit more follow-through at work :|)

  • Main idea: Create a static site that supports collaborative python programming (i.e. replit without the server).
  • Status. Pre-alpha. Something of an MVP is complete. However, expect rough edges. Especially related to python operations and resolution of shared docs when collaborating. Loading of editor + python repl will feel rather slow/rough.
  • What's with the name? "Python with the bros in the browser."

MVP Implementation path w/ progress:

  • Svelte project
  • Run wasm from rust Package
  • Run wasm within web worker
  • Run python code using RustPython compiled to wasm.
  • Add nice editor (monaco, codemirror, etc.)
  • Add CRDT/collaboration with yjs
  • Add webrtc hookups for yjs/collaboration on editor code
  • ~~~Add CRDT validation of python editor output/state.~~~ (Not an MVP element)
  • Deploy to github pages (truly static)

Features

Glues a lot of components together, particularly in the sveltekit/vite context:

  • WASM
    • Simple/example wasm (i.e. greet, fibonacci)
    • (sort of...) Non-trivial WASM (i.e. make use of a complex crate)
  • Web workers (w/ typescript)
  • Rich editors
  • WebRTC
  • YJS

Development

In development, web workers will only work well/hot reload in chromium-based browsers! (Or, at least, firefox does not work.)

To get started:

git clone [email protected]:michaelwooley/pybros.github
cd pybros
npm i

npm run dev

Open localhost:3000.

Build wasm

cd src/lib/wasm
wasm-pack build --target web --dev

# To build
wasm-pack build --target web

# https://github.com/rustwasm/wasm-pack/issues/457#issuecomment-457024036
# cargo install cargo-watch
cargo watch -i .gitignore -i "pkg/*" -s "wasm-pack build --target web --dev"

RustPython work

ā— IMPORTANT: Before going any further, run this command:

rustup update stable

Acknowledgements

This is really just a glue job. All of the magic here is due to these projects:

Top categories

Loading Svelte Themes