Skip to content

FE-514: Add SymPy β†’ JavaScript compilation pipeline via Pyodide#8548

Draft
kube wants to merge 1 commit intocf/fe-514-compile-typescript-expressions-to-sympyfrom
cf/simulator-sympy-expressions
Draft

FE-514: Add SymPy β†’ JavaScript compilation pipeline via Pyodide#8548
kube wants to merge 1 commit intocf/fe-514-compile-typescript-expressions-to-sympyfrom
cf/simulator-sympy-expressions

Conversation

@kube
Copy link
Collaborator

@kube kube commented Mar 14, 2026

🌟 What is the purpose of this PR?

πŸ”— Related links

  • ...

🚫 Blocked by

  • ...

πŸ” What does this change?

  • ...

Pre-Merge Checklist πŸš€

🚒 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing
  • modifies an npm-publishable library and I have added a changeset file(s)
  • modifies a Cargo-publishable library and I have amended the version
  • modifies a Cargo-publishable library, but it is not yet ready to publish
  • modifies a block that will need publishing via GitHub action once merged
  • I am unsure / need advice

πŸ“œ Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change
  • are in a state where docs changes are not yet required but will be
  • require changes to docs which are made as part of this PR
  • require changes to docs which are not made in this PR
    • Provide more detail here
  • I am unsure / need advice

πŸ•ΈοΈ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph
  • affected the execution graph, and the turbo.json's have been updated to reflect this
  • I am unsure / need advice

⚠️ Known issues

🐾 Next steps

πŸ›‘ What tests cover this?

❓ How to test this?

  1. Checkout the branch / view the deployment
  2. Try X
  3. Confirm that Y

πŸ“Ή Demo

Replace direct JS compilation with a SymPy intermediate representation:
user TypeScript is compiled to SymPy Python, evaluated/simplified by real
SymPy (via Pyodide WASM), then converted back to JavaScript for execution.

- Add pyodide dependency and singleton manager for loading SymPy in worker
- Create Python codegen module with custom JS printer for SymPy β†’ JS
- Create compile-via-sympy.ts orchestrating the full pipeline
- Extend compile-to-sympy.ts with symbol tracking and Dynamics per-token
  body emission (no list comprehension for tokens.map)
- Make buildSimulation async, using SymPy compilation pipeline
- Add "compiling" progress messages and pyodideUrl support to worker
- Update all simulation tests with vi.mock for async SymPy compilation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Error Error Mar 14, 2026 8:07pm
petrinaut Ready Ready Preview Mar 14, 2026 8:07pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Mar 14, 2026 8:07pm
hashdotdesign-tokens Ignored Ignored Preview Mar 14, 2026 8:07pm

@github-actions github-actions bot added area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Mar 14, 2026
Copy link
Collaborator Author

kube commented Mar 14, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deps Relates to third-party dependencies (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant