diff --git a/.gitignore b/.gitignore deleted file mode 100755 index fe46c1e..0000000 --- a/.gitignore +++ /dev/null @@ -1,46 +0,0 @@ -*.py[cod] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -var -sdist -develop-eggs -.installed.cfg -lib -lib64 -__pycache__ - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox -nosetests.xml - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -.log - -.idea -qpython-docs/venv/* -qpython-docs/build/* -qpython-docs/static/* -venv -site -.DS_Store -qpython diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 381bb57..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,107 +0,0 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Project Overview - -This is the QPython website and documentation repository (www.qpython.org). QPython is a Python script engine for Android devices. The site is built with [Sphinx](https://www.sphinx-doc.org/) using reStructuredText (.rst) source files. - -## Build Commands - -All build commands should be run from the `qpython-docs/` directory: - -```bash -cd qpython-docs -``` - -### Development Build (Local Testing) - -Build HTML documentation for local testing: - -```bash -make html -``` - -Output will be in `qpython-docs/build/html/`. Open `build/html/index.html` in a browser to preview. - -### Production Build (Deployment) - -Build the full site including analytics, static file processing, and copy to the deployment directory: - -```bash -./build.sh -``` - -This script: -1. Removes the existing `docs/` folder at the repository root -2. Runs `make html` to build the documentation -3. Adds Google Analytics and Facebook comments via `add-analytics.py` -4. Renames `_static/` to `static/` and `_images/` to `images/` -5. Copies additional static files (CNAME, favicon.ico, index.html, privacy pages, etc.) -6. Outputs final site to `/docs/` (which is deployed via GitHub Pages) - -### Other Useful Commands - -```bash -make clean # Remove build artifacts -make linkcheck # Check for broken external links -make doctest # Run doctests in documentation -``` - -## Project Architecture - -### Directory Structure - -``` -qpython-docs/ -├── source/ # Documentation source files (.rst) -│ ├── document.rst # Main toctree (entry point) -│ ├── conf.py # Sphinx configuration -│ ├── _static/ # Static assets (CSS, images) -│ ├── en/ # English documentation -│ │ ├── guide.rst -│ │ ├── faq.rst -│ │ └── ... -│ ├── zh/ # Chinese documentation -│ └── qpython_theme/ # Custom Sphinx theme -│ └── __init__.py -├── build.sh # Production build script -├── add-analytics.py # Post-processor for analytics injection -├── extra.txt # Analytics code template -├── requirements.txt # Python dependencies -└── Makefile # Sphinx build commands - -docs/ # Built site (deployment target) -├── index.html # Site homepage -├── document.html # Documentation homepage -├── en/ # Built English docs -├── _sources/ # Source archives (for Sphinx) -└── ... -``` - -### Key Files - -- **`qpython-docs/source/conf.py`**: Sphinx configuration including theme (`qpython_theme`), version, and extensions -- **`qpython-docs/source/document.rst`**: Main documentation entry point with toctree -- **`qpython-docs/build.sh`**: Production build script that processes the Sphinx output and prepares it for deployment -- **`qpython-docs/extra.txt`**: Template for injecting Google Analytics and Facebook comments into HTML -- **`docs/CNAME`**: Configures custom domain (www.qpython.org) for GitHub Pages - -### Custom Theme - -The documentation uses a custom Sphinx theme located at `qpython-docs/source/qpython_theme/`. The theme path is registered in `conf.py` via the `qpython_theme` package. - -### Documentation Languages - -- English: `qpython-docs/source/en/` -- Chinese: `qpython-docs/source/zh/` - -Each language has its own toctree structure. The master document (`document.rst`) includes the English guide by default and links to Chinese content via `zhindex.rst`. - -### Deployment - -The `docs/` folder at the repository root is the deployment target. It is served via GitHub Pages. After making changes: - -1. Run `./build.sh` to rebuild the site -2. Commit the changes in both `qpython-docs/source/` (source) and `docs/` (built output) -3. Push to deploy diff --git a/source/CNAME b/CNAME similarity index 100% rename from source/CNAME rename to CNAME diff --git a/README.md b/README.md deleted file mode 100755 index 9f3d368..0000000 --- a/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# About - -QPython is a script engine that runs Python on android devices. It lets your android device run Python scripts and projects. It contains the Python interpreter, console, editor, and the SL4A Library for Android. - -This is the www.qpython.org website and documentation's project. - -## More information - -Please visit [QPython Project Readme](https://github.com/qpython-android/qpython/blob/master/README.md) diff --git a/source/agreement-cn.html b/agreement-cn.html similarity index 100% rename from source/agreement-cn.html rename to agreement-cn.html diff --git a/source/agreement.html b/agreement.html similarity index 100% rename from source/agreement.html rename to agreement.html diff --git a/en/404.html b/en/404.html new file mode 100644 index 0000000..7d634d6 --- /dev/null +++ b/en/404.html @@ -0,0 +1,2376 @@ + + + +
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+ AIPyApp is an intelligent tool in QPython that uses AI to automatically generate Python programs from natural language instructions.
+
AIPyApp transforms the way you write code - simply describe what you want in natural language, and the AI will generate the Python program for you. QPython will also feature AIPy Academy - a platform offering Python programming courses tailored for the AI era.
+If AIPyApp is not installed, you will be prompted to confirm the installation. Press Enter to proceed.
+QPython will automatically download and install the required dependencies from PYPI. Please wait patiently for the installation to complete.
+After installation, return to the QPython Dashboard and long press the start button again to launch AIPyApp.
+On the first launch, you need to provide an AI API key:
+Your AI key will be saved for future sessions.
+After configuration, you enter the AIPyApp console mode. Simply type your instructions in natural language!
+Try entering:
+ +AIPyApp will: +1. Understand your natural language request +2. Generate the corresponding Python code +3. Execute the program automatically
+That's it - you've created a working Python program without writing any code!
+The example above demonstrates how AIPyApp can: +- Understand Chinese instructions +- Generate QSL4A-based Python code +- Run the program immediately
+Explore AIPyApp to discover more capabilities and start building Python programs effortlessly.
+Stay tuned for AIPy Academy at aipy.org - upcoming courses on learning and using Python programming in the AI era.
+ + + + + + + + + + + + + + + +
+
+
+
+ This guide explains how to enable graphical interface support (Turtle and Tkinter) in QPython on Android devices.
+
QPython can run Turtle and Tkinter applications, but requires additional software to provide graphical display support on Android.
+Before starting, you need to download the following resources:
+Download and install Xserver.apk from the QPython Extra resources directory on Google Drive.
+Open QPython and navigate to QPYPI. Find and install the Turtle & Tkinter QPython graphical interface extension.
+To prevent Xserver from being killed when running in the background:
+This ensures Xserver continues running when switched to background.
+Similarly, set QPython's battery management to "Unrestricted" to prevent process termination:
+Start the Xserver app and switch it to run as a background task before running your Turtle/Tkinter application.
+After completing the setup:
+You can download and try the Turtle Draw Doraemon demo program from QPYPI's first extension section of QPython App to verify your setup.
+
+
+
+
+ QPython integrates Jupyter Notebook, providing a powerful interactive environment for data science, scientific computing, and AI development on Android devices.
+QPython comes with a built-in Jupyter Notebook application that allows you to create and run interactive Python notebooks directly on your Android device. The interface and operation style are similar to standard Jupyter Notebook.
+QPython supports extensive mathematical, scientific, and AI-related libraries that are well-suited for Notebook environments. Install them via QPYPI as needed:
+Since QPython's Notebook operates similarly to Jupyter Notebook, you can refer to the official Jupyter Notebook documentation for detailed usage instructions and tips.
+To install the libraries you need:
+Install only the libraries you need for your specific use case.
+The Notebook application in QPython provides:
+For more details on Notebook operations and features, consult the Jupyter Notebook documentation.
+ + + + + + + + + + + + + + + +
+
+
+
+ Ollama is a local large language model runtime framework that supports a variety of models including Deepseek, Qwen, and Gemma. QPython has built-in Ollama integration, enabling developers to explore GenAI development directly on their mobile devices.
+Ollama allows you to run powerful large language models locally on your Android device. With QPython's integration, you can:
+Ollama supports many popular open-source models:
+In the Shell Terminal, use Ollama commands to download models. For mobile devices, we recommend smaller models for faster response times.
+# Pull a model (example: deepseek-r1 with 1.5 billion parameters)
+ollama pull deepseek-r1:1.5b
+
+# Pull other models
+ollama pull qwen:2.5
+ollama pull gemma:2b
+Start the Ollama service to make the model available via API:
+ +When running, Ollama will output the local port address (default: 11434).
+Install the openai library from QPYPI:
After starting ollama serve, you can use the OpenAI-compatible API to interact with your local model:
from openai import OpenAI
+
+# Configure the client
+client = OpenAI(
+ api_key="deepseek", # Can be any string
+ base_url="https://localhost:11434/v1" # Ollama's local address
+)
+
+# Chat with the model
+response = client.chat.completions.create(
+ model="deepseek-r1:1.5b", # Match the model you downloaded
+ messages=[
+ {"role": "user", "content": "What is Python?"}
+ ]
+)
+
+print(response.choices[0].message.content)
+| Model | +Parameters | +Best For | +
|---|---|---|
| deepseek-r1 | +1.5b | +Fast responses, general tasks | +
| qwen:2.5 | +2.5b | +Balanced performance | +
| gemma:2b | +2b | +Lightweight tasks | +
Larger models will work but may respond slower on mobile devices.
+# List installed models
+ollama list
+
+# Remove a model
+ollama rm deepseek-r1:1.5b
+
+# Show model information
+ollama show deepseek-r1:1.5b
+
+# Create a custom model (Modelfile)
+ollama create mymodel -f Modelfile
+
+
+
+
+ Terminal is one of the most frequently used features in QPython. It's a powerful tool for exploring Python features and libraries, experimenting with new syntax, and managing packages.
+
QPython provides multiple terminal options to suit different needs:
+On the Dashboard, long press the Terminal icon to access additional options:
+The QPython Shell Terminal provides a quick way to execute Python commands and explore Python features.
+>>> print("Hello from QPython!")
+Hello from QPython!
+>>> import math
+>>> math.sqrt(16)
+4.0
+>>> [x**2 for x in range(10)]
+[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
+IPython offers a much more powerful interactive Python experience with enhanced features.
+% for common tasksIn [1]: import numpy as np
+
+In [2]: arr = np.array([1, 2, 3, 4, 5])
+
+In [3]: arr?
+Type: ndarray
+String form: [1 2 3 4 5]
+Length: 5
+...
+
+In [4]: %timeit arr ** 2
+The slowest run took 12.34 microseconds...
+The PIP Client provides command-line access to Python package management.
+# Install a package
+pip install requests
+
+# List installed packages
+pip list
+
+# Upgrade a package
+pip install --upgrade requests
+
+# Uninstall a package
+pip uninstall requests
+
+# Search for packages
+pip search json
+pip help to see all available commands| Tool | +Best For | +
|---|---|
| Shell Terminal | +Quick calculations, simple scripts, testing snippets | +
| IPython | +Complex exploration, data analysis, interactive debugging | +
| PIP Client | +Installing/updating packages, checking dependencies | +
0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return i}function B(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o