Skip to content

Commit 87d905a

Browse files
committed
Change default Python version from 3.8 to 3.10 (#1039)
1 parent 1da966b commit 87d905a

File tree

28 files changed

+131
-325
lines changed

28 files changed

+131
-325
lines changed

.github/actions/setup-python/action.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Setup Python
22
description:
33

4-
# When updating this file, see the comment in ci.yml about integration test
5-
# runner versions.
64
runs:
75
using: composite
86
steps:
@@ -15,24 +13,25 @@ runs:
1513
id: python-default
1614
shell: bash
1715
run: |
18-
version=3.8
16+
version="3.10"
17+
echo "full_version=${version}.11"
1918
if [ $RUNNER_OS = Windows ]; then
2019
echo "command=py -$version"
21-
echo "version=3.8.10"
2220
else
2321
echo "command=python$version"
24-
echo "version=3.8.12"
2522
fi >> $GITHUB_OUTPUT
2623
2724
- uses: actions/[email protected]
2825
with:
2926
# This should include all major.minor versions supported by the runtime, plus
30-
# OLD_PYTHON_VERSION from test_gradle_plugin.
27+
# OLD_PYTHON_VERSION from test_gradle_plugin. The available versions on each
28+
# runner are listed at
29+
# https://github.com/actions/python-versions/blob/main/versions-manifest.json.
3130
python-version: |
3231
3.7
33-
${{ steps.python-default.outputs.version }}
32+
3.8
3433
3.9
35-
3.10
34+
${{ steps.python-default.outputs.full_version }}
3635
3.11
3736
3.12
3837
3.13

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ jobs:
165165
os: [macos, windows, linux]
166166
agp-version: ${{ fromJSON(needs.product.outputs.agp-versions) }}
167167
include:
168-
# Runners must support all the Python versions in setup-python/action.yml: see
169-
# https://github.com/actions/python-versions/blob/main/versions-manifest.json.
168+
# Runners must support all the Python versions in setup-python/action.yml.
170169
- os: linux
171170
runs-on: ubuntu-22.04
172171
- os: macos

demo/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ android {
9696

9797
chaquopy {
9898
defaultConfig {
99-
version = "3.8"
99+
version = "3.10"
100100

101101
// Android UI demo
102102
pip {

product/buildSrc/src/main/java/com/chaquo/python/internal/Common.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class Common {
3434
}
3535
}
3636

37-
public static final String DEFAULT_PYTHON_VERSION = "3.8";
37+
public static final String DEFAULT_PYTHON_VERSION = "3.10";
3838

3939
// Wheel tags (PEP 425).
4040
public static final String PYTHON_IMPLEMENTATION = "cp"; // CPython

product/gradle-plugin/README.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,46 @@ also be given here.
8585
directory](https://developer.android.com/studio/intro/studio-config#file_location).
8686

8787

88-
## Adding support for a buildPython version
88+
## Adding a Python version
89+
90+
Target:
91+
92+
* Update Common.java.
93+
* Build the target packages as described in target/README.md.
94+
95+
Product:
96+
97+
* In test_gradle_plugin.py, update the `PYTHON_VERSIONS` assertion.
98+
* Update the `MAGIC` lists in test_gradle_plugin.py and pyc.py.
99+
* Update .github/actions/setup-python/action.yml.
100+
* Build any packages used by the demo app.
101+
* Update android.rst and versions.rst.
102+
103+
Tests (this list is referenced from target/README.md):
89104

90-
* Update `MAX_BUILD_PYTHON_VERSION` in test_gradle_plugin.py, and run the tests which
91-
use it.
92105
* Run `gradle:testPython`.
93-
* Update the list of Python versions in .github/actions/setup-python/action.yml.
94-
* Temporarily change the `buildPython` of the demo app, comment out `pyc.pip`, and check
95-
it builds without any warnings other than the expected ones about .pyc compilation.
96-
There's no point in running it now, as the failed compilation will break many of the
97-
tests. We'll do this when we add runtime support for the same version (see
98-
target/README.md).
106+
* Run integration tests.
107+
* Temporarily change the Python version of the demo app, and run the Python and Java
108+
unit tests on the full set of pre-release devices (see release/README.md).
99109

100110

101-
## Removing support for a buildPython version
111+
## Removing a Python version
102112

103113
* Increment Chaquopy major version if not already done.
104-
* Update gradle-plugin/src/main/python/chaquopy/util.py.
105-
* In test_gradle_plugin, update `OLD_BUILD_PYTHON_VERSION` and
106-
`MIN_BUILD_PYTHON_VERSION`, and run the tests which use them.
107-
* Run `gradle:testPython`.
108-
* Update the list of Python versions in .github/actions/setup-python/action.yml.
109-
* See the comment in ci.yml about integration test runner versions, and consider
110-
updating them.
111-
* Update android.rst.
114+
* Update any references in the integration tests, including the names of the pythonX.Y
115+
scripts in data/BuildPython.
116+
* Search source code for `(python( version)?|version_info) *[<>=]* *[0-9]` to see if any
117+
workarounds can now be removed.
118+
* Check if any modules can be removed from `BOOTSTRAP_NATIVE_STDLIB` in PythonTasks.kt.
119+
* Update and test all the things listed in the "Adding a Python version" section.
120+
121+
122+
## Changing the default Python version
123+
124+
* Update `DEFAULT_PYTHON_VERSION` in Common.java and test_gradle_plugin.py.
125+
* Update and test all the things listed in the "Adding / Removing a Python version"
126+
sections.
127+
* Update the Python version in all apps in the repository, and test them.
112128

113129

114130
## Increasing minimum API level (minSdk)
@@ -179,12 +195,11 @@ do the following:
179195
* Open tools/base as a project in IDEA.
180196

181197

182-
## Updating pip, setuptools or wheel
198+
## Updating pip
183199

184200
Check out the upstream-pip branch.
185201

186-
Delete the package from src/main/python, including the .dist-info directory. Note that
187-
setuptools includes some files outside of its main directory.
202+
Delete pip from src/main/python, including the .dist-info directory.
188203

189204
Download the wheel of the new version, and unpack it into src/main/python.
190205

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
plugins {
22
id 'com.chaquo.python'
33
}
4-
5-
chaquopy {
6-
defaultConfig {
7-
version "3.8"
8-
}
9-
}

product/gradle-plugin/src/test/integration/data/BuildPython/default_change/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
versionCode 1
1515
versionName "0.0.1"
1616
python {
17-
version "3.9"
17+
version "{{ secondPythonVersion }}"
1818
pip {
1919
install "six"
2020
}

product/gradle-plugin/src/test/integration/data/Dsl/groovy_new/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
versionCode 1
1515
versionName "0.0.1"
1616
ndk {
17-
abiFilters "x86"
17+
abiFilters "x86_64"
1818
}
1919
}
2020

@@ -39,7 +39,7 @@ chaquopy {
3939

4040
// productFlavors properties
4141
def p = chaquopy.productFlavors.property
42-
p.version = "3.9"
42+
p.version = "{{ secondPythonVersion }}"
4343
p.extractPackages.add "ep_property"
4444
p.staticProxy.add "sp_property"
4545
p.pip.install("certifi")
@@ -52,7 +52,7 @@ p.pyc.stdlib = false
5252
chaquopy {
5353
productFlavors {
5454
method {
55-
version "3.10"
55+
version "{{ thirdPythonVersion }}"
5656
extractPackages("ep_method")
5757
staticProxy("sp_method")
5858
pip {

0 commit comments

Comments
 (0)