bump minimum Python to 3.9

This commit is contained in:
Damien Elmes 2021-10-04 15:05:15 +10:00
parent 5dc385c9b7
commit e9c7b2287f
12 changed files with 23 additions and 25 deletions

View file

@ -3,7 +3,7 @@ common --experimental_repository_cache_hardlinks
# specify python path for pyo3 compile # specify python path for pyo3 compile
build:windows --action_env="PYO3_PYTHON=c:/python/python.exe" build:windows --action_env="PYO3_PYTHON=c:/python/python.exe"
#build:linux --action_env="PYO3_PYTHON=/usr/local/bin/python3.8" #build:linux --action_env="PYO3_PYTHON=/usr/local/bin/python3.9"
# only affects the ankihelper library # only affects the ankihelper library
#build:macos --macos_cpus=x86_64,arm64 #build:macos --macos_cpus=x86_64,arm64

View file

@ -15,14 +15,14 @@ Pre-built Python packages are available on PyPI. They are useful if you wish to:
- Get code completion when developing add-ons - Get code completion when developing add-ons
- Make command line scripts that modify .anki2 files via Anki's Python libraries - Make command line scripts that modify .anki2 files via Anki's Python libraries
You will need the 64 bit version of Python 3.8 or 3.9 installed. If you do not You will need the 64 bit version of Python 3.9 or 3.10 installed. If you do not
have Python yet, please see the platform-specific instructions in the "Building have Python yet, please see the platform-specific instructions in the "Building
from source" section below for more info. from source" section below for more info.
**Mac/Linux**: **Mac/Linux**:
``` ```
$ python3.8 -m venv ~/pyenv $ python3.9 -m venv ~/pyenv
$ ~/pyenv/bin/pip install --upgrade pip $ ~/pyenv/bin/pip install --upgrade pip
$ ~/pyenv/bin/pip install aqt $ ~/pyenv/bin/pip install aqt
``` ```

View file

@ -18,18 +18,18 @@ $ sudo apt install bash grep findutils curl gcc g++ git
The 'find' utility is 'findutils' on Debian. The 'find' utility is 'findutils' on Debian.
**Install Python 3.8**: **Install Python 3.9**:
If you're on a modern distribution, you may be able to install Python from the repo: If you're on a modern distribution, you may be able to install Python from the repo:
``` ```
$ sudo apt install python3.8 $ sudo apt install python3.9
``` ```
If you are using a packaged Python version that is installed in /usr/bin, you can jump If you are using a packaged Python version that is installed in /usr/bin, you can jump
immediately to the next section after ensuring python3.8-distutils is installed. immediately to the next section after ensuring python3.9-distutils is installed.
If Python 3.8 is not available in your distro, you can download it from If Python 3.9 is not available in your distro, you can download it from
python.org, compile it, and install it in /usr/local. If you're on a basic python.org, compile it, and install it in /usr/local. If you're on a basic
Debian install, make sure you have the following installed before building Debian install, make sure you have the following installed before building
Python: Python:
@ -41,12 +41,12 @@ other than /usr/bin, you'll need to put the following into a file called user.ba
at the top of this repo before proceeding: at the top of this repo before proceeding:
``` ```
build --action_env=PYO3_PYTHON=/usr/local/bin/python3.8 build --action_env=PYO3_PYTHON=/usr/local/bin/python3.9
``` ```
If you're building Anki from a docker container or distro that has no `python` command in If you're building Anki from a docker container or distro that has no `python` command in
/usr/bin, you'll need to symlink `python` to `/usr/bin/python`. `/usr/bin/python` does not /usr/bin, you'll need to symlink `python` to `/usr/bin/python`. `/usr/bin/python` does not
need to be Python 3.8; any version will do. `apt install python-is-python3` can also be need to be Python 3.9; any version will do. `apt install python-is-python3` can also be
used to link python3 to python. used to link python3 to python.
If your system only has Python 3.9, you should be able to build Anki with it, If your system only has Python 3.9, you should be able to build Anki with it,

View file

@ -17,9 +17,9 @@ Then install deps:
$ brew install rsync bazelisk $ brew install rsync bazelisk
``` ```
**Install Python 3.8**: **Install Python 3.9**:
Install Python 3.8 from <https://python.org>. We have heard reports Install Python 3.9 from <https://python.org>. We have heard reports
of issues with pyenv and homebrew, so the package from python.org is of issues with pyenv and homebrew, so the package from python.org is
the only recommended approach. the only recommended approach.
@ -29,10 +29,10 @@ You do not need to set up a Python venv prior to building Anki.
When you run "python" in a shell, if it shows Python 2.x, you may get a When you run "python" in a shell, if it shows Python 2.x, you may get a
bunch of hashlib warnings during build. You can work around this by bunch of hashlib warnings during build. You can work around this by
pointing python to python3.8: pointing python to python3.9:
``` ```
$ ln -sf /usr/local/bin/{python3.8,python} $ ln -sf /usr/local/bin/{python3.9,python}
``` ```
This linking will not work if you're using the system Python from Big Sur, This linking will not work if you're using the system Python from Big Sur,

View file

@ -15,9 +15,9 @@ Install the [Visual Studio build tools](https://visualstudio.microsoft.com/downl
Make sure the "C++ build tools" box is selected, and leave the default optional Make sure the "C++ build tools" box is selected, and leave the default optional
components enabled on the right. components enabled on the right.
**Python 3.8**: **Python 3.9**:
Download the 64 bit Python 3.8 from <https://python.org>. Run the installer, Download the 64 bit Python 3.9 from <https://python.org>. Run the installer,
and customize the installation. Select "install for all users", and choose and customize the installation. Select "install for all users", and choose
the install path as c:\python. Currently the build scripts require the install path as c:\python. Currently the build scripts require
Python to be installed in that location. Python to be installed in that location.

View file

@ -77,7 +77,7 @@ py_wheel(
"//platforms:linux_arm64": "manylinux2014_aarch64", "//platforms:linux_arm64": "manylinux2014_aarch64",
}), }),
python_tag = "cp38", python_tag = "cp38",
python_version = ">=3.8", python_version = ">=3.9",
requires = [ requires = [
"beautifulsoup4", "beautifulsoup4",
"requests[socks]", "requests[socks]",

View file

@ -1,5 +1,5 @@
[mypy] [mypy]
python_version = 3.8 python_version = 3.9
pretty = false pretty = false
no_strict_optional = true no_strict_optional = true
show_error_codes = true show_error_codes = true

View file

@ -12,7 +12,7 @@ anki = { path = "../../rslib" }
# /cargo/update.py needs to be run if updating the version below # /cargo/update.py needs to be run if updating the version below
[dependencies.pyo3] [dependencies.pyo3]
version = "0.14.5" version = "0.14.5"
features = ["extension-module", "abi3", "abi3-py38"] features = ["extension-module", "abi3", "abi3-py39"]
[lib] [lib]
name = "rsbridge" name = "rsbridge"

View file

@ -29,7 +29,7 @@ if __name__ == "__main__":
"-m", "-m",
"black", "black",
"-t", "-t",
"py38", "py39",
"anki", "anki",
"tests", "tests",
"tools", "tools",

View file

@ -1,10 +1,8 @@
def _impl(rctx): def _impl(rctx):
# locate python on path, and export it # locate python on path, and export it
names = [ names = [
# prefer 3.8 over 3.9, as pylint currently fails on 3.9 "python3.9",
# (due to issues like https://github.com/PyCQA/pylint/pull/3890) "python3.10",
"python3.8",
"python3",
"python.exe", "python.exe",
] ]
path = None path = None

View file

@ -1,5 +1,5 @@
[mypy] [mypy]
python_version = 3.8 python_version = 3.9
no_strict_optional = true no_strict_optional = true
show_error_codes = true show_error_codes = true
disallow_untyped_decorators = True disallow_untyped_decorators = True

View file

@ -28,7 +28,7 @@ if __name__ == "__main__":
"-m", "-m",
"black", "black",
"-t", "-t",
"py38", "py39",
"--exclude=aqt/forms|colors|_gen", "--exclude=aqt/forms|colors|_gen",
"aqt", "aqt",
"tests", "tests",