-
-
Notifications
You must be signed in to change notification settings - Fork 145
Add fetch support to MicroPython demo #195
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
Conversation
- Redesign micropython.html to match quickjs.html layout and styling - Add fetch() capability via MicroPython's js module interop (import js; await js.fetch()) - Add example buttons with Python equivalents: Hello World, Factorial, Fibonacci, List Comprehensions, Dictionaries & JSON, Prime Numbers, String Fun, FizzBuzz, Sorting, Classes, and Fetch Data - Add URL hash management for code sharing - Add copy button for output - Add keyboard shortcuts (Ctrl/Cmd+Enter to run, Tab for indentation) - Add fetch test to the test suite - Preserve existing Run Tests functionality
|
I'll analyze this and get back to you. |
|
With linebuffer:true, each stdout callback receives a complete line but without the trailing newline character. Add \n when capturing.
Deploying tools with
|
| Latest commit: |
cffdaf9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://62013f6d.tools-b1q.pages.dev |
| Branch Preview URL: | https://claude-micropython-fetch-sup.tools-b1q.pages.dev |
|
Claude finished @simonw's task —— View job PR Review: Add fetch support to MicroPython demoReview Checklist:
SummaryThis PR successfully adapts the QuickJS demo design to MicroPython, maintaining visual consistency while implementing Python-specific functionality. The implementation is well-structured and addresses the core requirements. Identified Issues🐛 Critical Bug: Missing Newlines in Print OutputConfirmed Issue: As noted by simonw,
Root Cause ( function pushOutput(kind, text) {
if (!text) return;
if (activeCapture) {
activeCapture[kind] += text + '\n'; // ← Adds newline to every output
}
// ...
}Solution: Remove the automatic newline addition in Code Quality & Best Practices✅ Strengths
🔄 Areas for Improvement1. Fetch Implementation Inconsistency ( # Uses await js.fetch() (async) vs QuickJS synchronous fetch()
response = await js.fetch(repo_url)
data = json.loads(await response.text())
2. Error Message Clarity ( if (err?.stdout) output += String(err.stdout).trimEnd();
if (err?.stderr) {
if (output) output += '\n';
output += String(err.stderr).trimEnd();
}
if (output) output += '\n';
output += String(err?.message ?? err);
Security Considerations✅ Security Strengths
|

https://gisthost.github.io/?2c4d32513791acd6b1d9a5fed34a158d/index.html