Skip to content

Commit 2af420d

Browse files
bajrangCoderclaude
andcommitted
docs: update README and changelog for 1.2.0
Rewrite the README around current features (packages, micropip, plots, experimental pygame, console features), limitations and development notes, replacing outdated sections. Group the 1.2.0 changelog into new, improved, fixed and development changes, and add the missing 1.1.4 entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b19930e commit 2af420d

3 files changed

Lines changed: 90 additions & 32 deletions

File tree

‎README.md‎

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,87 @@
1-
# acode-plugin-python
1+
# Python for Acode
22

3-
Plugin to run python code in [Acode](https://acode.foxdebug.com) editor for android. This plugin uses [Pyodide](https://pyodide.org) project to run python in browser.
3+
Run Python 3.14 in the [Acode](https://acode.app) editor on Android. Python runs on your device through [Pyodide](https://pyodide.org), so no server or Termux setup is needed.
44

5-
## Plugin is underdevelopment
5+
## Features
66

7-
Using this plugin you can run python codes but you cannot import other python files yet, so, this feature will be supportted in future updates.
7+
- **Run Python files**: open a `.py` file and tap the run button in the header
8+
- **Interactive console**: type Python after your program finishes; `input()` works too
9+
- **Python packages**: `import numpy`, `pandas`, `matplotlib` and many more are downloaded automatically the first time you use them
10+
- **Install from PyPI** with `micropip`
11+
- **Plots and images**: `matplotlib` figures and Pillow images are shown right in the console
12+
- **pygame (experimental)**: games draw to a canvas in the console
13+
- **Copy output**: console text can be selected and copied
14+
- **Line wrap**: toggle wrapping of long output lines from the header button
15+
- **Progress indicator**: a thin line under the header shows while Python is loading or your code is running
816

9-
### Update 1.0.7
17+
## Usage
1018

11-
- Bugs fixes
12-
- Updated pyodide
19+
Open a Python file and tap the run button. The console shows your program's output, errors in red, and a prompt for `input()`.
1320

14-
### Update 1.1.0
21+
After the program finishes, you can keep typing Python in the console. Use the up and down arrows to browse previous commands and `Ctrl+L` to clear the console.
1522

16-
- Bugs fixes
17-
- Reduces waiting time
23+
### Packages
1824

19-
### Update 1.2.0
25+
Packages built for Pyodide (numpy, pandas, scipy, matplotlib, Pillow and [many more](https://pyodide.org/en/stable/usage/packages-in-pyodide.html)) load automatically when imported. They are downloaded the first time, so an internet connection is needed then.
2026

21-
- Python 3.14 (Pyodide 314.0.7)
22-
- Import packages like `numpy` or `pandas` directly. They are downloaded on first use (internet required)
23-
- Install pure Python packages from PyPI with `micropip`:
27+
Pure Python packages from PyPI can be installed with `micropip`:
2428

2529
```python
2630
import micropip
2731
await micropip.install("snowballstemmer")
32+
33+
import snowballstemmer
34+
print(snowballstemmer.stemmer("english").stemWords(["running", "jumps"]))
2835
```
2936

3037
### Plots and images
3138

32-
`matplotlib` figures are shown in the console when you call `plt.show()`, and any figures left open are shown when the program ends. Figures default to the width of the console and are rendered at the screen's pixel density. Pillow's `Image.show()` works too.
39+
`plt.show()` displays matplotlib figures in the console, and any figures still open are shown when the program ends. Figures default to the width of the console and are rendered sharp on high-density screens. Pillow's `Image.show()` works too.
40+
41+
```python
42+
import matplotlib.pyplot as plt
43+
import numpy as np
44+
45+
x = np.linspace(0, 2 * np.pi, 200)
46+
plt.plot(x, np.sin(x), label="sin(x)")
47+
plt.legend()
48+
plt.show()
49+
```
3350

3451
### pygame (experimental)
3552

36-
pygame programs can draw to a canvas in the console using Pyodide's [SDL support](https://pyodide.org/en/stable/usage/sdl.html). Ordinary game loops work as written:
53+
pygame programs draw to a canvas in the console using Pyodide's [SDL support](https://pyodide.org/en/stable/usage/sdl.html). Ordinary game loops work as written:
3754

3855
```python
3956
import pygame
4057

4158
pygame.init()
4259
screen = pygame.display.set_mode((1280, 720))
4360
clock = pygame.time.Clock()
61+
running = True
62+
63+
while running:
64+
for event in pygame.event.get():
65+
if event.type == pygame.QUIT:
66+
running = False
4467

45-
while True:
4668
screen.fill("purple")
4769
pygame.display.flip()
4870
clock.tick(60)
71+
72+
pygame.quit()
4973
```
5074

51-
This needs a WebView with JSPI support (Android System WebView 137+), which lets the loop pause at `display.flip()` / `Clock.tick()` so the app stays responsive. On older WebViews, use an async loop (`await asyncio.sleep(0)` each frame) instead. If SDL cannot start, the program runs without a display. Running again or closing the console stops the game.
75+
- Blocking loops like this need Android System WebView 137 or newer (JSPI support). On older WebViews, make the loop async with `await asyncio.sleep(0)` each frame.
76+
- Running again or closing the console stops the game.
77+
- If SDL cannot start, the program runs without a display and the console explains why.
78+
79+
## Limitations
80+
81+
- Only the open file runs; importing your other `.py` files is not supported yet.
82+
- Code runs in the browser sandbox: no access to device files outside Python's in-memory file system, and no `subprocess` or threads.
83+
- Packages with native code must be [built for Pyodide](https://pyodide.org/en/stable/usage/packages-in-pyodide.html); others cannot be installed with `micropip`.
84+
- Requires a recent Android System WebView.
5285

5386
## Development
5487

@@ -61,6 +94,12 @@ npm run check # lint and format check (Biome)
6194

6295
In Acode, install from **Plugins → + → Remote** using `http://<your-ip>:3000/plugin.zip`.
6396

64-
## WARNING
97+
Source layout:
98+
99+
- `src/main.js`: console page, run button and Acode integration
100+
- `src/worker.js`: runs Python in a web worker
101+
- `src/sdl.js`: experimental SDL runtime on the main thread, loaded only for pygame
102+
- `src/runtime.js`: Pyodide setup shared by both runtimes
103+
- `src/python/`: Python helpers for showing plots/images and running pygame loops
65104

66-
This is plugin might not be supported in your device. To check weather this plugin is supported in your device or not, open console declare variable using 'const' key word. If it throws a error, your device doesn't support this plugin.
105+
See [changelog.md](changelog.md) for release notes.

‎changelog.md‎

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,38 @@
22

33
## 1.2.0
44

5-
- Updated Pyodide to 314.0.7 (Python 3.14)
6-
- Packages such as `numpy`, `pandas` and `micropip` are now downloaded on demand when imported
7-
- Errors written to stderr are now shown in red
8-
- Console output can now be selected and copied
5+
### New
6+
7+
- Python 3.14: updated Pyodide from 0.28.1 to 314.0.7
8+
- Packages such as `numpy`, `pandas`, `matplotlib` and `micropip` are downloaded automatically when imported (internet needed on first use)
9+
- matplotlib plots are shown in the console, on `plt.show()` or automatically when the program ends. Plots are sized to the console and rendered sharp on high-density screens
10+
- Pillow's `Image.show()` displays images in the console
11+
- Experimental pygame support: games draw to a canvas in the console, including ordinary blocking game loops on WebViews with JSPI (Android System WebView 137+). If SDL cannot start, the program runs without a display and the reason is shown
912
- Header button to toggle line wrap in the console (remembered between sessions)
10-
- Thin progress line under the console header while Python loads or code is running
11-
- matplotlib plots are shown in the console (`plt.show()`, or automatically at the end of a run), as are Pillow `Image.show()` images. Plots are sized to the console and rendered sharp on high-density screens
12-
- Experimental SDL support: pygame programs draw to a canvas in the console, including ordinary blocking game loops on WebViews with JSPI. Falls back to running without a display if SDL cannot start
13-
- Python crashes no longer leave the console stuck; Python restarts on the next run
14-
- Fixed Python failing to load (or staying on "loading...") on some devices
15-
- Clear error message when Python fails to load, with automatic retry on the next run
16-
- Smaller plugin size (removed stale Pyodide files)
17-
- Migrated build tooling to esbuild, matching the official plugin template
13+
- Thin progress line under the console header while Python is loading or code is running
14+
15+
### Improved
16+
17+
- Console output can be selected and copied
18+
- Errors written to stderr are shown in red
19+
- Clear error message when Python fails to load, with an automatic retry on the next run
20+
- If Python crashes, the console no longer gets stuck; Python restarts on the next run
21+
- Smaller plugin download (removed stale Pyodide files)
22+
23+
### Fixed
24+
25+
- Python failing to load on some devices (`importScripts ... failed to load` followed by `Cannot read properties of undefined (reading 'loadPackagesFromImports')`)
26+
- Python staying on "loading..." forever when the device serves `.wasm` files with the wrong type
27+
- pygame failing with `Failed to connect to localhost/127.0.0.1:443` when another plugin replaces `fetch`
28+
29+
### Development
30+
31+
- Build tooling migrated from webpack, Babel, PostCSS and Sass to esbuild, matching the [official plugin template](https://github.com/Acode-Foundation/acode-plugin)
32+
- The Pyodide runtime is installed from npm and copied into the build, so a clean checkout builds a working plugin
33+
34+
## 1.1.4
35+
36+
- New run icon
1837

1938
## 1.1.3
2039

‎plugin.zip‎

2.49 KB
Binary file not shown.

0 commit comments

Comments
 (0)