Skip to content

About

Ultra-lightweight native Python IDE for Android powered by PocketPy C11 engine with live Deye Solarman V5 reader.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

22 Commits

Folders and files

Repository files navigation

⚑ PocketPy IDE & Cross-Platform Runtime

Release v2.0 Build Status Platform Engine Functions Tests APK Size License

Download APK Download Windows Binary

PocketPy IDE is an ultra-fast, lightweight, cross-platform Python IDE and standalone runtime powered by the embeddable PocketPy C11 engine with over 160+ native system, network, crypto, and hardware extensions.

Every single script, network service, and system command runs identically across Android, Windows, and Linux.

While traditional Python mobile distributions (like Chaquopy or Termux CPython) require massive 80–120 MB downloads and suffer from sluggish interpreter cold starts, PocketPy IDE delivers full script execution, live syntax highlighting, an ANSI streaming terminal, HTML5/SVG visualization, and comprehensive system control in an astonishing 2.94 MB APK footprint with sub-20ms instant boot. On Windows, the entire standalone CLI compiler and runtime packs all 160+ native functions into a tiny ~359 KB binary.


πŸ“₯ Download & Installation

Pre-compiled, signed binaries and packages are built automatically via CI/CD for every release:

Platform Download Format Description
πŸ“± Android PocketPy-IDE-2.0.apk APK (2.94 MB) Complete IDE with Material 3 Compose UI, Code Editor, ANSI Terminal & WebView
πŸͺŸ Windows x64 pocketpy-windows-x64.zip ZIP (~359 KB) Standalone pocketpy.exe CLI runner with native Winsock2, Win32 I/O & Win32 APIs
πŸ“¦ All Releases GitHub Releases Overview Release Assets Release notes, source code, and artifacts for all versions

πŸš€ Key Features

  • πŸͺΆ Ultra-Lightweight Footprint:
    • Android APK shrunk from 18 MB down to 2.94 MB via ProGuard/R8 optimization and amalgamated C11 native compilation.
    • Windows executable is a self-contained single .exe of only ~750 KB (uncompressed) with zero external DLL dependencies.
  • ⚑ Blazing Execution Speed & Instant Cold Start:
    • Sub-20ms boot time with minimal memory footprint (< 30 MB RAM).
    • Direct C-level function bindings without Python reflection overhead.
  • πŸ”Œ 160+ Native Extensions (100% Cross-Platform):
    • Sockets, POSIX/Win32 filesystem, low-level file descriptors, hardware telemetry, cryptography, binary packing, SQLite3, and extended math.
  • πŸ§ͺ 100% Test Coverage:
    • Exhaustive automated test suite (tests/test_full_suite.py) validating all 142 core test assertions across Android, Windows MSVC, and Linux.
  • ✍️ Mobile Code Editor:
    • Real-time Python syntax highlighting (keywords, built-ins, string literals, numbers, comments).
    • Quick-access programming symbol bar (:, (, ), [, ], {, }, _, =, ", ', #, tab).
  • πŸ“Ÿ Real-Time ANSI Terminal:
    • Unbuffered stdout/stderr streaming directly from native C11 execution hooks.
    • ANSI color parser with live execution timer, Clear, and Copy tools.
  • 🌐 Visual HTML5/SVG Output:
    • Dedicated interactive WebView tab for dashboards, SVG diagrams, and web apps.

🧩 160+ Native Extensions & Module Overview

Module Native Functions Windows Equivalent Description
socket 20 APIs Winsock2 (WSAStartup, SOCKET, closesocket) TCP Client/Server (bind, listen, accept), UDP (sendto, recvfrom), timeouts, non-blocking I/O, setsockopt(SO_REUSEADDR).
os & os.path 50+ APIs Win32 CRT (_mkdir, _rmdir, FindFirstFileA, _open, _pipe) Directory & file management, low-level file descriptors (open, read, write, fsync), environment variables, and cross-platform path manipulation (nt vs posix).
sysinfo 15 APIs GlobalMemoryStatusEx, GetTickCount64, GetSystemInfo RAM total/free/avail, system uptime, processor count, storage capacity, and hardware model inspection.
time 12 APIs QueryPerformanceCounter, GetSystemTimeAsFileTime, Sleep Monotonic & high-resolution performance counters, timestamps (time, time_ns), timezone detection, and localtime/gmtime/strftime.
device / hardware (compat: android) 15 APIs Win32 Fallbacks (Beep(), GetSystemPowerStatus()) Cross-platform hardware control: Battery status/charging, Toast/balloon alerts, haptic feedback, audio beep, notifications, TTS speech, clipboard get/set.
hashlib 12 APIs Pure C11 (portable) Modbus CRC-16, CRC-32, Adler-32, MD5, SHA-1, SHA-256, hex encoding/decoding, hexdump, XOR byte encryption, and cryptographic random bytes.
struct 15 APIs Pure C11 (portable) Binary packing and unpacking for signed/unsigned 8-bit, 16-bit, 32-bit integers and 32/64-bit IEEE floats (Big & Little Endian).
storage & sqlite3 14 APIs In-memory + persistent Key-Value dictionary store and embedded SQLite3 SQL engine (CREATE, INSERT, SELECT, parameterized queries).
math_ext 10 APIs C math clamp, lerp, map_range, degrees, radians, hypot, gcd, lcm, sign, is_close.

πŸ’» CLI Runner Usage (Windows, Linux, macOS)

PocketPy includes a standalone CLI binary (pocketpy.exe on Windows or ./pocketpy on Linux):

1. Interactive REPL

Simply launch the binary to start the interactive prompt:

pocketpy
PocketPy 2.0 (C11 Runtime with 160+ Native Extensions)
Type 'exit()' or press Ctrl+C / Ctrl+D to quit.
>>> import socket, sys, os
>>> print("Running on:", sys.platform, "OS:", os.name)
Running on: win32 OS: nt
>>> socket.gethostname()
'My-Desktop-PC'

2. Execute Code Directly (-c)

pocketpy -c "import hashlib; print(hashlib.sha256(b'hello'))"
# 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

3. Run Scripts with Arguments

pocketpy script.py arg1 arg2

4. Run the Exhaustive Test Suite

pocketpy tests/test_full_suite.py
# ================================================================
# TEST RESULTS: 142 PASSED, 0 FAILED (TOTAL: 142)
# ALL TESTS PASSED WITH 100% SUCCESS!
# ================================================================

πŸ“Š Comparison: PocketPy vs Traditional Python

Metric Traditional Python (CPython/Chaquopy) PocketPy 2.0 (C11 Core)
Android APK Size ~80 MB – 120 MB 2.94 MB (97% smaller)
Windows Executable ~25 MB – 50 MB installer ~359 KB ZIP (single self-contained .exe)
Cold Startup Time 1,500 ms – 3,000 ms < 20 ms (instant execution)
RAM Consumption ~150 MB – 250 MB ~20 MB – 30 MB
C Extensions Requires compiler & headers for wheels 160+ native functions built-in directly
Network & Sockets Complex platform dependencies Native Winsock2 & POSIX dual-stack engine
Ideal Use Cases Heavy data science (numpy, pandas) IoT automation, Solar/Modbus tools, HTTP microservers, fast scripts, embedded utilities

🧩 Included Production Sample Scripts

PocketPy IDE comes preloaded with production-ready sample projects:

  1. 1_pocketpy_speed_test.py β€” Benchmarks list comprehensions, iterative loops, and prime number calculations to illustrate C11 speed.
  2. 2_ascii_sine_waves.py β€” Renders animated trigonometric waves in the terminal using ANSI colors and math_ext.
  3. 3_interactive_dashboard.html β€” Responsive dark-mode HTML5/SVG status dashboard rendered live inside the Visual WebView.
  4. 4_deye_reader.py β€” Industrial Modbus TCP telemetry monitor for Deye solar inverters with live register decoding.
  5. 5_system_and_hardware.py β€” Diagnostic monitor inspecting CPU cores, memory utilization, disk space, and OS properties.
  6. 6_device_hardware.py β€” Demonstrates cross-platform hardware control: Toast/notifications, haptic feedback, audible beeps, battery status, and TTS speech.
  7. 7_mini_webserver.py β€” Embedded HTTP server running on port 8080 serving real-time system metrics to external web browsers.

πŸ› οΈ Project Architecture

PocketPy-IDE
 β”œβ”€β”€ CMakeLists.txt              # Top-level CMake (Windows MSVC/MinGW & Linux/macOS)
 β”œβ”€β”€ tests/
 β”‚    └── test_full_suite.py     # Comprehensive 142-assertion test suite
 β”œβ”€β”€ app/
 β”‚    β”œβ”€β”€ build.gradle.kts       # Android Gradle build with R8 shrinking
 β”‚    └── src/main/
 β”‚         β”œβ”€β”€ cpp/
 β”‚         β”‚    β”œβ”€β”€ pocketpy.c   # Core PocketPy C11 engine
 β”‚         β”‚    β”œβ”€β”€ pocketpy.h   # Core C API definitions
 β”‚         β”‚    β”œβ”€β”€ pocketpy_ext.h # 160+ cross-platform extensions (Winsock2 & POSIX)
 β”‚         β”‚    β”œβ”€β”€ pocketpy_jni.c # Android JNI bridge & unbuffered stdout hooks
 β”‚         β”‚    └── cli_main.c   # Standalone CLI entrypoint (pocketpy.exe / pocketpy)
 β”‚         └── java/com/pocketpy/ide/
 β”‚              β”œβ”€β”€ engine/      # PocketPy JNI wrapper & Android hardware services
 β”‚              β”œβ”€β”€ ui/          # Jetpack Compose UI (Editor, Terminal, WebView, Drawer)
 β”‚              └── data/        # File management & bundled sample scripts

πŸ—οΈ Building from Source

1. Android APK

Prerequisites: Android Studio / SDK (API 36), Android NDK 25+, JDK 17.

git clone https://github.com/juergen874/PocketPy-IDE.git
cd PocketPy-IDE

# Make gradlew executable
chmod +x gradlew

# Build optimized release APK
./gradlew assembleRelease

The output APK is generated at app/build/outputs/apk/release/PocketPy-IDE-2.0.apk.

2. Windows Standalone CLI (pocketpy.exe)

Prerequisites: Visual Studio 2022 (MSVC) or MinGW (GCC/Clang), CMake 3.20+.

git clone https://github.com/juergen874/PocketPy-IDE.git
cd PocketPy-IDE

# Configure & build with CMake
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

# Test the binary
.\build\Release\pocketpy.exe tests\test_full_suite.py

3. Linux / macOS Standalone CLI (pocketpy)

Prerequisites: GCC or Clang, Make, CMake 3.20+.

cmake -B build -S .
cmake --build build
./build/pocketpy tests/test_full_suite.py

πŸ“„ License

PocketPy IDE is distributed under the MIT License.
The PocketPy core engine is copyright (c) blakehuang and licensed under the MIT License.

About

Ultra-lightweight native Python IDE for Android powered by PocketPy C11 engine with live Deye Solarman V5 reader.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages