Add Pyodide implementation#117
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces Pyodide, a Python distribution for the browser, to enable the execution of Python code directly within the application. A significant part of this integration involves creating a robust bridge between Python and a JavaScript-based PyTorch implementation, allowing users to write PyTorch-compatible Python code that leverages the underlying JavaScript library. This expands the platform's capabilities to support Python-based machine learning and data science workflows directly in the browser. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
7edc67b to
adc811e
Compare
There was a problem hiding this comment.
Code Review
This pull request integrates Pyodide to enable running Python code, specifically PyTorch, within the JavaScript environment. Key changes include adding pyodide and torch dependencies, configuring Rollup and Jest for Python file handling, and introducing a PyodideEvaluator to manage Pyodide execution. A Python bridge (bridge.py) is implemented to provide a PyTorch-compatible API over a JavaScript torch library, along with an importAnalyzer to rewrite torch imports and identify other modules for micropip installation. Review comments highlight a concern regarding the torch dependency being pulled from a custom, potentially unstable URL, recommending the use of officially published versions. A functional limitation in torch.cat is noted, as it currently only supports dim=0, suggesting either broader compatibility or clear documentation. Finally, the use of a dummy statement (_ = 0\n) in importAnalyzer.ts to satisfy the py-slang grammar is identified as a workaround that relies on internal parser details, with a recommendation for a more robust parsing solution.
| "pyodide": "^0.29.3", | ||
| "torch": "https://pkg.pr.new/veehz/torch@297abf6", |
There was a problem hiding this comment.
The torch dependency is being pulled from a custom URL (https://pkg.pr.new/veehz/torch@297abf6). Relying on a specific, potentially temporary, branch or fork for a dependency can lead to instability, lack of updates, and security concerns. It's generally recommended to use officially published versions from a package registry (e.g., npm) or a stable, versioned release.
|
Fixes #11 |
71fdabc to
9d86260
Compare
No description provided.