Upgrade from Python 3.9.4 to Python 3.10.6
Closes #6309 which I got into a bad git state. :-( But then the Renovate tool auto-undid my butchery. :-) Closes #5727
My sense is that:
- [x]
.python-versioncan be removed as it was only used by pyenv - [x]
.github/workflows/codegen_api_docs.ymlneeds to be updated - [x]
.github/workflows/python_tests.ymlneeds to be updated - [x]
.pre-commit-config.yamlneeds to be updated - [x]
python3.10 -m venv --upgrade .venv
Technical
Testing
Screenshot
Stakeholders
For testing, please do:
- On ol-dev1 (in
ol-cclauss), check out branch and build a new olbase image tagged-t openlibrary/olbase:py3.10 - Ask @cdrini to push this up to docker hub once it's done
- Pull it down locally and test the site with the
OLIMAGEparam- Also test solr-updater starts up ok ; it's using FnToCLI which has caused issues with types/python handling of types
- Restart testing.openlibrary.org with the
OLIMAGEparam ; confirm things work - Merge!
(Also: OMG py3.10 has pattern matching!!!)
Lots of neat goodies in here! https://docs.python.org/3/whatsnew/3.10.html But pattern matching definitely steals the show :) Nothing looks too breaking
Now that Ubuntu 22.04 LTS (Jammy Jellyfish) is shipping with Python 3.10.4 as the default Python, there is another way to execute this PR -- Stay on Ubuntu but upgrade to the current LTS.
docker run --rm -it ubuntu:jammy bash
# And then inside that ubuntu:jammy container do...
apt-get -qq update && apt-get install -y python3 && python3 --version && exit
--> Python 3.10.4
The Pro is that we stay on Ubuntu LTS but the cons are that future Python upgrades remain complex and we loose the opportunity to slim down our image size.
My vote is that we continue with this PR which shifts us from Ubuntu to Debian-slim.
I also vote for debian slim
Based on https://github.com/internetarchive/openlibrary/tree/master/docker#developing-the-dockerfile
And https://github.com/internetarchive/openlibrary/pull/6340#issuecomment-1086270358
On ol-dev1 in /opt/ol-cclauss
- [ ]
docker build --no-cache -t openlibrary/olbase:py3.10 -f docker/Dockerfile.olbase .
Installing collected packages: pip WARNING: The scripts pip, pip3 and pip3.10 are installed in '/home/openlibrary/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Step 25/27 : RUN npm ci Fails on conflicts.
@jimchamp and I went thru the process together today on Zoom and were unable to resolve the npi ci issues. We will probably need to Zoom with @cdrini to make progress on the build.
@cdrini on Slack > Ahh, this thing. I thought we fixed this... let me take a look @cdrini on Slack > Ah we did fix it! Do a rebase against master and it should work :+1:
➜ docker build --no-cache -t openlibrary/olbase:py3.10 -f docker/Dockerfile.olbase .
[ ... ]
Successfully built 9ca97e31171a
Successfully tagged openlibrary/olbase:py3.10
➜ hostname ; pwd
ol-dev1.us.archive.org
/opt/ol-cclauss
Yeah! Progress. (Doah! I had rebased locally but not on ol-dev1. Arrggh)
https://internetarchive.slack.com/archives/C06RPDLTG/p1659973072425089
Python 3.11 release candidate 1 has just shipped at https://www.python.org/download/pre-releases
We run infogami and openlibrary tests on Python 3.11 pre-release at: https://github.com/internetarchive/infogami/blob/master/.github/workflows/python_tests.yml and https://github.com/internetarchive/infogami/blob/master/.github/workflows/openlibrary_tests.yml