From 1566a9be9815cfc9a8fff9bd487e9b7563018c4c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 2 Dec 2020 11:23:01 +1000 Subject: [PATCH] remove explicit python3.9 reference due to pylint 3.8 will be used if available --- docs/development.md | 10 +++++----- docs/linux.md | 11 ++++++----- docs/mac.md | 7 ++++++- docs/windows.md | 2 ++ python.bzl | 8 +++++++- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/development.md b/docs/development.md index 19c7a100b..78c75cd07 100644 --- a/docs/development.md +++ b/docs/development.md @@ -26,11 +26,9 @@ $ pyenv/bin/python -c 'import aqt; aqt.run()' From Anki 2.1.36 onwards: -- Make sure your pip version is 20 or later (pip install --upgrade pip). -- Then: - ``` $ python -m venv pyenv +$ pyenv/bin/pip install --upgrade pip $ pyenv/bin/pip install aqt $ pyenv/bin/python -c 'import aqt; aqt.run()' ``` @@ -58,6 +56,8 @@ From inside the source folder: bazel test //... ``` +Pylint will currently fail if you're using Python 3.9. + ## Fixing formatting If the format tests fail, most can be fixed by running `format` @@ -84,8 +84,8 @@ bazel build -c opt //pylib/anki:wheel bazel build -c opt //qt/aqt:wheel ``` -The generated wheel paths will be printed as the build completes. To install -them, see earlier in this document. +The generated wheel paths will be printed as the build completes. You can install +them with pip. ## Audio diff --git a/docs/linux.md b/docs/linux.md index 794b2790b..1138d553b 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -20,13 +20,14 @@ If you're on a modern distribution, you may be able to install Python from the r $ sudo apt install python3.8 ``` -If python3.8 is not available in your distro, you can download it from python.org. +If Python 3.8 is not available in your distro, you can download it from python.org, +compile it, and install in in /usr/local. -Notes: +If your system only has Python 3.9, you should be able to build Anki with it, +but the pylint tests will currently fail, as pylint does not yet support Python 3.9. -- The build scripts expect to find 'python3.8' on your path, so Python 3.7 or 3.9 will - not work. -- An active Python venv is not required, and may cause problems. +Anki's build system will not place packages in system locations, so you do not +need to build with an active Python virtual environmental. **Install Bazelisk**: diff --git a/docs/mac.md b/docs/mac.md index 2a6aa9d43..5bffb527f 100644 --- a/docs/mac.md +++ b/docs/mac.md @@ -22,6 +22,8 @@ $ brew install rsync bazelisk Install Python 3.8 from . You may be able to use the Homebrew version instead, but this is untested. +Python 3.9 is not currently recommended, as pylint does not support it yet. + 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 @@ -32,6 +34,9 @@ pointing python to python3.8: $ ln -sf /usr/local/bin/{python3.8,python} ``` +This linking will not work if you're using the system Python from Big Sur, +which is one of the reasons why we recommend using Python from python.org. + ## Running Anki during development From the top level of Anki's source folder: @@ -42,7 +47,7 @@ From the top level of Anki's source folder: This will build Anki and run it in place. -The first build will take while, as it downloads and builds a bunch of +The first build will take a while, as it downloads and builds a bunch of dependencies. When the build is complete, Anki will automatically start. To play audio, use Homebrew to install mpv. At the time of writing, recording is diff --git a/docs/windows.md b/docs/windows.md index aeebb229e..df661f59c 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -24,6 +24,8 @@ Python to be installed in that location. When the install is done, click on the "remove the path limit" button. +Python 3.9 is not currently recommended, as pylint does not support it yet. + **MSYS**: Install [msys2](https://www.msys2.org/) into the default folder location. diff --git a/python.bzl b/python.bzl index d7f6446d9..67b7d72c1 100644 --- a/python.bzl +++ b/python.bzl @@ -1,6 +1,12 @@ def _impl(rctx): # locate python on path, and export it - names = ["python3.9", "python3.8", "python3", "python.exe"] + names = [ + # prefer 3.8 over 3.9, as pylint currently fails on 3.9 + # (due to issues like https://github.com/PyCQA/pylint/pull/3890) + "python3.8", + "python3", + "python.exe", + ] path = None for name in names: path = rctx.which(name)