-
Notifications
You must be signed in to change notification settings - Fork 0
Research: Pyright-playground and BasedPyright browser execution analysis with implementation plan #3
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
base: MP_CODEMIRROR
Are you sure you want to change the base?
Conversation
Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
|
@copilot |
…ode examples Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Yes, basedpyright has a true browser-native implementation! Key findings:
Complete details with code examples in BASEDPYRIGHT_BROWSER_RESEARCH.md including:
Implementation example from basedpyright-playground shows creating workers, LSP connections, and handling diagnostics. All type checking happens in browser with no server component. Commit: 442db18 |
|
@copilot, |
…asedpyright Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Yes, browser-basedpyright can use custom stub packages like micropython-esp32-stubs! How it works: initializationOptions: {
files: {
'/src/main.py': userCode,
'/stubs/machine.pyi': machineStubContent,
'/stubs/esp32.pyi': esp32StubContent,
// ... all 69 MicroPython stub files
}
}Three integration methods:
MicroPython-ESP32-Stubs:
Complete guide with code examples in CUSTOM_STUBS_GUIDE.md including:
Commit: 42a71c5 |
|
@copilot Please plan for an implementation that allows the type stubs to be changed between a few ports that are provided as .json files. RP2, we assembly, Unix, stm32 and esp32. A user should be able to select the stubs port using a dropdown in the editor. The end state should offer 2 different demos/Editors + LSP
Try to keep the code DRY and reduce duplication where appropriate |
…thon stub selection Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Comprehensive implementation plan created in IMPLEMENTATION_PLAN.md. Plan includes:
Directory structure: Key features:
Timeline: ~14-19 hours across 5 phases. Commit: 9890c69 |
|
The editor should be using code mirror rather than monaco |
Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com>
Updated implementation plan to use CodeMirror instead of Monaco Editor. Changes made:
Why CodeMirror:
Implementation includes:
Commit: eb2b1a7 |
Investigated how pyright-playground (https://pyright-play.net) and basedpyright execute Pyright to determine if browser-native execution is feasible for this project, and researched how to integrate custom type stub packages. Based on findings, created a comprehensive implementation plan for dual LSP demo system with MicroPython stub port selection using CodeMirror editor.
Key Findings
Pyright-Playground (Server-Based)
Pyright-playground does NOT run Pyright in the browser. It uses a traditional Node.js server architecture:
Both pyright-playground and python-language-server spawn Pyright as Node.js child processes. Main difference: HTTP REST vs WebSocket communication.
BasedPyright (True Browser Execution)
BasedPyright DOES have a browser-native implementation via the
browser-basedpyrightnpm package:https://cdn.jsdelivr.net/npm/browser-basedpyright@version/dist/pyright.worker.jsCustom Stub Packages
Browser-basedpyright CAN use custom type stub packages like
micropython-esp32-stubs:Documentation Added
Implementation Plan (NEW)
Created a comprehensive implementation plan for building dual LSP demo system with MicroPython stub port selection:
Planned Features
Architecture Design
Key Components Specified
Editor Choice: CodeMirror 6
Why CodeMirror instead of Monaco:
CodeMirror Features:
Implementation Phases
Total Timeline: 14-19 hours
Stub JSON Format
{ "port": "esp32", "version": "1.26.0", "files": { "/stubs/machine.pyi": "...", "/stubs/esp32.pyi": "..." }, "metadata": { "description": "MicroPython ESP32", "moduleCount": 69, "sizeKB": 250 } }Architecture Comparison
BasedPyright Browser Implementation
The research includes detailed documentation of browser-basedpyright:
Architecture:
Code Examples Provided:
Technical Details:
Custom Stub Package Integration
The research includes a comprehensive guide for using custom type stubs:
Integration Methods:
Complete Examples:
MicroPython Use Case:
Recommendations
Current WebSocket architecture is appropriate for Jesse's use case. Consider adopting from pyright-playground:
BasedPyright browser edition warranted if:
Created from VS Code via the GitHub Pull Request extension.
Original prompt
Created from VS Code via the GitHub Pull Request extension.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.