Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyodide #1096

Merged
merged 10 commits into from
Feb 5, 2025
Merged

pyodide #1096

merged 10 commits into from
Feb 5, 2025

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Feb 5, 2025


Summary of Changes

This update introduces Pyodide integration into the project, enabling Python execution in JavaScript environments. Key highlights include:

  • 🚀 Pyodide Integration: Added support for running Python code via Pyodide, a CPython WebAssembly port.

    • Introduced a python method in the RuntimeHost interface to instantiate Python runtime environments.
    • Implemented the PyodideRuntime class to manage Python code execution and package imports using micropip.
  • 📄 Documentation: Added a new documentation page (pyodide.mdx) explaining Pyodide usage, including running Python code, interacting with the workspace file system, and importing Python packages.

  • 🧪 Unit Tests: Added comprehensive tests for Pyodide functionality:

    • Verifying Python code execution.
    • Checking file system access within the /workspace directory.
    • Ensuring Python package installation and usage (e.g., snowballstemmer).
    • Testing Python exception handling.
  • 🛠️ CLI Enhancements: Updated the CLI build process to include Pyodide as an external dependency.

  • 📦 Dependencies: Added pyodide as a dependency in both core and cli packages.

  • 🧑‍💻 Sample Usage: Added a sample script (pyodide.genai.mjs) demonstrating how to retrieve the Python version using the new Pyodide runtime.

  • PromptContext Update: Extended createPromptContext to support Python runtime instantiation via the python method.

These changes enable seamless Python integration within the project, enhancing its versatility and enabling powerful cross-language workflows.

AI-generated content by prd may be incorrect

@pelikhan pelikhan merged commit 1e72c80 into main Feb 5, 2025
9 of 15 checks passed
@pelikhan pelikhan deleted the pyodide branch February 5, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant