Skip to content

Commit 591fb7d

Browse files
committed
Merge branch 'develop' into ava
2 parents 3afc183 + 9c46b9a commit 591fb7d

149 files changed

Lines changed: 5133 additions & 3626 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/push.yml

Lines changed: 87 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout python-for-android
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v5
2323
- name: Set up Python 3.x
24-
uses: actions/setup-python@v5
24+
uses: actions/setup-python@v6
2525
with:
2626
python-version: 3.x
2727
- name: Run flake8
@@ -30,21 +30,40 @@ jobs:
3030
pip install tox>=2.0
3131
tox -e pep8
3232
33+
spotless:
34+
name: Java Spotless check
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout python-for-android
38+
uses: actions/checkout@v5
39+
- name: Set up Java 17
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: 'temurin'
43+
java-version: '17'
44+
- name: Set up Gradle
45+
uses: gradle/actions/setup-gradle@v4
46+
- name: Run Spotless check
47+
working-directory: pythonforandroid/bootstraps
48+
run: ./common/build/gradlew spotlessCheck
49+
3350
test:
3451
name: Pytest [Python ${{ matrix.python-version }} | ${{ matrix.os }}]
35-
needs: flake8
52+
needs: [flake8, spotless]
3653
runs-on: ${{ matrix.os }}
3754
strategy:
55+
fail-fast: false
3856
matrix:
39-
python-version: ['3.8', '3.9', '3.10', '3.11']
40-
os: [ubuntu-latest, macOs-latest]
57+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', '3.14t']
58+
os: [ubuntu-latest, macos-latest]
4159
steps:
4260
- name: Checkout python-for-android
43-
uses: actions/checkout@v4
61+
uses: actions/checkout@v5
4462
- name: Set up Python ${{ matrix.python-version }}
45-
uses: actions/setup-python@v5
63+
uses: actions/setup-python@v6
4664
with:
4765
python-version: ${{ matrix.python-version }}
66+
allow-prereleases: true
4867
- name: Tox tests
4968
run: |
5069
python -m pip install --upgrade pip
@@ -59,9 +78,8 @@ jobs:
5978

6079
ubuntu_build:
6180
name: Build test APP [ ${{ matrix.runs_on }} | ${{ matrix.bootstrap.name }} ]
62-
needs: [flake8]
81+
needs: [flake8, spotless]
6382
runs-on: ${{ matrix.runs_on }}
64-
continue-on-error: true
6583
strategy:
6684
matrix:
6785
runs_on: [ubuntu-latest]
@@ -77,8 +95,18 @@ jobs:
7795
- name: qt
7896
target: testapps-qt
7997
steps:
98+
- name: Maximize build space
99+
uses: easimon/maximize-build-space@v10
100+
with:
101+
root-reserve-mb: 30720
102+
swap-size-mb: 1024
103+
remove-dotnet: 'true'
104+
remove-android: 'true'
105+
remove-haskell: 'true'
106+
remove-codeql: 'true'
107+
remove-docker-images: 'true'
80108
- name: Checkout python-for-android
81-
uses: actions/checkout@v4
109+
uses: actions/checkout@v5
82110
- name: Build python-for-android docker image
83111
run: |
84112
docker build --tag=kivy/python-for-android .
@@ -109,14 +137,13 @@ jobs:
109137

110138
macos_build:
111139
name: Build test APP [ ${{ matrix.runs_on }} | ${{ matrix.bootstrap.name }} ]
112-
needs: [flake8]
140+
needs: [flake8, spotless]
113141
runs-on: ${{ matrix.runs_on }}
114-
continue-on-error: true
115142
strategy:
116143
matrix:
117-
# macos-latest (ATM macos-14) runs on Apple Silicon,
118-
# macos-13 runs on Intel
119-
runs_on: ['macos-latest', 'macos-13']
144+
# macos-latest (ATM macos-15) runs on Apple Silicon,
145+
# macos-15-intel runs on Intel
146+
runs_on: ['macos-latest', 'macos-15-intel']
120147
bootstrap:
121148
- name: sdl2
122149
target: testapps-with-numpy
@@ -129,14 +156,14 @@ jobs:
129156
ANDROID_NDK_HOME: ${HOME}/.android/android-ndk
130157
steps:
131158
- name: Checkout python-for-android
132-
uses: actions/checkout@v4
159+
uses: actions/checkout@v5
133160
- name: Set up Python 3.x
134-
uses: actions/setup-python@v5
161+
uses: actions/setup-python@v6
135162
with:
136163
python-version: 3.x
137164
- name: Install python-for-android
138165
run: |
139-
python3 -m pip install -e .
166+
python3 -m pip install --editable .
140167
- name: Install prerequisites via pythonforandroid/prerequisites.py (Experimental)
141168
run: |
142169
python3 pythonforandroid/prerequisites.py
@@ -162,30 +189,52 @@ jobs:
162189
name: ${{ matrix.runs_on }}-${{ matrix.bootstrap.name }}-artifacts
163190
path: dist
164191

192+
test_on_emulator:
193+
name: Run App on Emulator
194+
needs: ubuntu_build
195+
runs-on: ubuntu-latest
196+
197+
steps:
198+
- uses: actions/checkout@v5
199+
- name: Download Artifacts
200+
uses: actions/download-artifact@v5
201+
with:
202+
name: ubuntu-latest-sdl2-artifacts
203+
path: dist/
204+
205+
- name: Setup and start Android Emulator
206+
uses: reactivecircus/android-emulator-runner@v2
207+
with:
208+
api-level: 30
209+
arch: x86_64
210+
script: ci/run_emulator_tests.sh
211+
165212
ubuntu_rebuild_updated_recipes:
166213
name: Test updated recipes for arch ${{ matrix.android_arch }} [ ubuntu-latest ]
167-
needs: [flake8]
214+
needs: [flake8, spotless]
168215
runs-on: ubuntu-latest
216+
# continue on error to see failures across all architectures
169217
continue-on-error: true
170218
strategy:
171219
matrix:
172220
android_arch: ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
173221
env:
174222
REBUILD_UPDATED_RECIPES_EXTRA_ARGS: --arch=${{ matrix.android_arch }}
175223
steps:
224+
- name: Maximize build space
225+
uses: easimon/maximize-build-space@v10
226+
with:
227+
root-reserve-mb: 30720
228+
swap-size-mb: 1024
229+
remove-dotnet: 'true'
230+
remove-android: 'true'
231+
remove-haskell: 'true'
232+
remove-codeql: 'true'
233+
remove-docker-images: 'true'
176234
- name: Checkout python-for-android (all-history)
177-
uses: actions/checkout@v4
235+
uses: actions/checkout@v5
178236
with:
179237
fetch-depth: 0
180-
# helps with GitHub runner getting out of space
181-
- name: Free disk space
182-
run: |
183-
df -h
184-
sudo swapoff -a
185-
sudo rm -f /swapfile
186-
sudo apt -y clean
187-
docker images -q | xargs -r docker rmi
188-
df -h
189238
- name: Pull docker image
190239
run: |
191240
make docker/pull
@@ -195,15 +244,16 @@ jobs:
195244
196245
macos_rebuild_updated_recipes:
197246
name: Test updated recipes for arch ${{ matrix.android_arch }} [ ${{ matrix.runs_on }} ]
198-
needs: [flake8]
247+
needs: [flake8, spotless]
199248
runs-on: ${{ matrix.runs_on }}
249+
# continue on error to see failures across all architectures
200250
continue-on-error: true
201251
strategy:
202252
matrix:
203253
android_arch: ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
204-
# macos-latest (ATM macos-14) runs on Apple Silicon,
205-
# macos-13 runs on Intel
206-
runs_on: ['macos-latest', 'macos-13']
254+
# macos-latest (ATM macos-15) runs on Apple Silicon,
255+
# macos-15-intel runs on Intel
256+
runs_on: ['macos-latest', 'macos-15-intel']
207257
env:
208258
ANDROID_HOME: ${HOME}/.android
209259
ANDROID_SDK_ROOT: ${HOME}/.android/android-sdk
@@ -212,16 +262,16 @@ jobs:
212262
REBUILD_UPDATED_RECIPES_EXTRA_ARGS: --arch=${{ matrix.android_arch }}
213263
steps:
214264
- name: Checkout python-for-android (all-history)
215-
uses: actions/checkout@v4
265+
uses: actions/checkout@v5
216266
with:
217267
fetch-depth: 0
218268
- name: Set up Python 3.x
219-
uses: actions/setup-python@v5
269+
uses: actions/setup-python@v6
220270
with:
221271
python-version: 3.x
222272
- name: Install python-for-android
223273
run: |
224-
python3 -m pip install -e .
274+
python3 -m pip install --editable .
225275
- name: Install prerequisites via pythonforandroid/prerequisites.py (Experimental)
226276
run: |
227277
python3 pythonforandroid/prerequisites.py
@@ -244,7 +294,7 @@ jobs:
244294
documentation:
245295
runs-on: ubuntu-latest
246296
steps:
247-
- uses: actions/checkout@v4
297+
- uses: actions/checkout@v5
248298
- name: Requirements
249299
run: |
250300
python -m pip install --upgrade pip

.github/workflows/pypi-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
twine check dist/*
2020
- name: Publish package
2121
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
22-
uses: pypa/gh-action-pypi-publish@v1.4.2
22+
uses: pypa/gh-action-pypi-publish@v1.13.0
2323
with:
2424
user: __token__
2525
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@ coverage.xml
3636
# testapp's build folder
3737
testapps/build/
3838

39+
# Gradle build artifacts (Java linting)
40+
pythonforandroid/bootstraps/.gradle/
41+
pythonforandroid/bootstraps/build/
42+
3943
# Dolphin (the KDE file manager autogenerates the file `.directory`)
4044
.directory

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,60 @@ latest python-for-android release that supported building Python 2 was version
6666
On August 2021, we added support for Android App Bundle (aab). As a
6767
collateral benefit, we now support multi-arch apk.
6868

69+
## Code Quality
70+
71+
### Python Linting
72+
73+
Python code is linted using flake8. Run it locally with:
74+
75+
```bash
76+
tox -e pep8
77+
```
78+
79+
### Java Linting
80+
81+
Java source files in the bootstrap directories are linted using
82+
[Spotless](https://github.com/diffplug/spotless) with Google Java Format
83+
(AOSP style). The CI runs this check automatically.
84+
85+
**Local execution** (requires Java 17+):
86+
87+
```bash
88+
# Check for violations
89+
make java-lint
90+
91+
# Auto-fix violations
92+
make java-lint-fix
93+
```
94+
95+
The Makefile uses the Gradle wrapper (`gradlew`), which automatically downloads
96+
the correct Gradle version on first run. No manual Gradle installation is required.
97+
98+
**Using Docker** (if you don't have Java 17):
99+
100+
```bash
101+
# Check for violations
102+
make docker/java-lint
103+
104+
# Auto-fix violations
105+
make docker/java-lint-fix
106+
```
107+
108+
The Docker approach builds the project's Docker image (which includes Java 17)
109+
and runs the linting inside the container.
110+
111+
**What gets linted:**
112+
113+
- All `.java` files in `pythonforandroid/bootstraps/*/build/src/main/java/`
114+
- Excludes third-party code (`org/kamranzafar/jtar/`)
115+
116+
**Formatting rules applied:**
117+
118+
- Google Java Format with AOSP style (Android-friendly indentation)
119+
- Removal of unused imports
120+
- Trailing whitespace trimming
121+
- Files end with newline
122+
69123
## Creating a new release
70124

71125
(These instructions are for core developers, not casual contributors.)

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ RUN ${RETRY} apt -y update -qq > /dev/null \
7171
make \
7272
openjdk-17-jdk \
7373
patch \
74-
patchelf \
7574
pkg-config \
7675
python3 \
7776
python3-dev \

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ virtualenv: $(VIRTUAL_ENV)
2424
test:
2525
$(TOX) -- tests/ --ignore tests/test_pythonpackage.py
2626

27+
# Java linting using Spotless (requires Java 17+, uses Gradle wrapper)
28+
java-lint:
29+
cd pythonforandroid/bootstraps && ./common/build/gradlew spotlessCheck
30+
31+
java-lint-fix:
32+
cd pythonforandroid/bootstraps && ./common/build/gradlew spotlessApply
33+
34+
# Java linting via Docker (no local Java required)
35+
docker/java-lint: docker/build
36+
docker run --rm -v $(CURDIR):/home/user/app -w /home/user/app/pythonforandroid/bootstraps $(DOCKER_IMAGE) ./common/build/gradlew spotlessCheck
37+
38+
docker/java-lint-fix: docker/build
39+
docker run --rm -v $(CURDIR):/home/user/app -w /home/user/app/pythonforandroid/bootstraps $(DOCKER_IMAGE) ./common/build/gradlew spotlessApply
40+
2741
# Also install and configure rust
2842
rebuild_updated_recipes: virtualenv
2943
. $(ACTIVATE) && \

ci/constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class TargetPython(Enum):
2525
# mpmath package with a version >= 0.19 required
2626
'sympy',
2727
'vlc',
28-
# need extra gfortran NDK system add-on
29-
'lapack', 'scipy',
28+
# GitHub CI runs out of storage while building it
29+
'scipy',
30+
'fortran',
3031
# Outdated and there's a chance that is now useless.
3132
'zope_interface',
3233
# Requires zope_interface, which is broken.

ci/makefiles/android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Downloads and installs the Android SDK depending on supplied platform: darwin or linux
22

33
# Those android NDK/SDK variables can be override when running the file
4-
ANDROID_NDK_VERSION ?= 25b
4+
ANDROID_NDK_VERSION ?= 28c
55
ANDROID_NDK_VERSION_LEGACY ?= 21e
66
ANDROID_SDK_TOOLS_VERSION ?= 6514223
77
ANDROID_SDK_BUILD_TOOLS_VERSION ?= 29.0.3
88
ANDROID_HOME ?= $(HOME)/.android
9-
ANDROID_API_LEVEL ?= 27
9+
ANDROID_API_LEVEL ?= 36
1010

1111
# per OS dictionary-like
1212
UNAME_S := $(shell uname -s)

0 commit comments

Comments
 (0)