Update workflows and docker to Python 3.11 (#3188)

* Use Python 3.11

* Run pyupgrade with Python 3.11+

* Update pyupgrade to latest version

* Update Celery and python-dateutil

Celery is not compatible with Python 3.11, leading to test failures. Need to update also python-dateutil to install the latest version.
This commit is contained in:
Francesco Lodolo 2024-04-25 12:31:24 +02:00 коммит произвёл GitHub
Родитель 545036caa7
Коммит 4b6e839447
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
15 изменённых файлов: 43 добавлений и 73 удалений

2
.github/workflows/backend.yml поставляемый
Просмотреть файл

@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
cache: pip
cache-dependency-path: |
requirements/default.txt

8
.github/workflows/py-lint.yml поставляемый
Просмотреть файл

@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Dependencies
run: |
pip install -U pip
@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Dependencies
run: |
pip install -U pip
@ -52,10 +52,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'
- name: Install Dependencies
run: |
pip install -U pip
pip install -r requirements/lint.txt
- name: pyupgrade
run: pyupgrade --py310-plus *.py `find pontoon -name \*.py`
run: pyupgrade --py311-plus *.py `find pontoon -name \*.py`

Просмотреть файл

@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: '3.10'
python: '3.11'
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"

Просмотреть файл

@ -119,10 +119,10 @@ flake8:
"${DC}" run --rm server flake8 pontoon/
pyupgrade:
"${DC}" run --rm server pyupgrade --exit-zero-even-if-changed --py310-plus *.py `find pontoon -name \*.py`
"${DC}" run --rm server pyupgrade --exit-zero-even-if-changed --py311-plus *.py `find pontoon -name \*.py`
check-pyupgrade:
"${DC}" run --rm server pyupgrade --py310-plus *.py `find pontoon -name \*.py`
"${DC}" run --rm server pyupgrade --py311-plus *.py `find pontoon -name \*.py`
black:
"${DC}" run --rm server black pontoon/

Просмотреть файл

@ -1,4 +1,4 @@
FROM python:3.10-bookworm AS server
FROM python:3.11-bookworm AS server
ARG USER_ID=1000
ARG GROUP_ID=1000

Просмотреть файл

@ -1,7 +1,8 @@
import re
from copy import deepcopy
from typing import Callable, cast
from typing import cast
from collections.abc import Callable
from fluent.syntax import ast as FTL
from fluent.syntax.serializer import serialize_expression

Просмотреть файл

@ -212,7 +212,7 @@ class ChangeSet:
)
)
verb = "updated with {} new string{}".format(count, pluralize(count))
verb = f"updated with {count} new string{pluralize(count)}"
contributors = User.objects.filter(
translation__entity__resource__project=self.db_project,
profile__new_string_notifications=True,

Просмотреть файл

@ -425,7 +425,7 @@ class HgRepository(VCSRepository):
"-a",
"-m",
"-r",
"--rev={}".format(self._strip(from_revision)),
f"--rev={self._strip(from_revision)}",
"--rev=default",
],
cwd=path,

Просмотреть файл

@ -16,7 +16,7 @@
# -------------------------------------------------------------------------------------------------
APScheduler==3.9.1.post1
bleach==6.1.0
celery==5.2.6
celery==5.4.0
compare-locales==9.0.3
dj-database-url==2.1.0
Django==4.2.11
@ -43,7 +43,7 @@ openai==1.12.0
polib==1.0.6
psycopg2==2.9.6
PyJWT==2.4.0
python-dateutil==2.8.1
python-dateutil==2.9.0
python-dotenv==0.17.0
python-levenshtein==0.12.2
raygun4py==4.3.0

Просмотреть файл

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# ./docker/compile_requirements.sh
@ -32,9 +32,9 @@ asgiref==3.8.1 \
# via
# django
# django-cors-headers
billiard==3.6.4.0 \
--hash=sha256:299de5a8da28a783d51b197d496bef4f1595dd023a93a4f59dde1886ae905547 \
--hash=sha256:87103ea78fa6ab4d5c751c4909bcff74617d985de7fa8b672cf8618afd5a875b
billiard==4.2.0 \
--hash=sha256:07aa978b308f334ff8282bd4a746e681b3513db5c9a514cbdd810cbbdc19714d \
--hash=sha256:9a3c3184cb275aa17a732f93f65b20c525d3d9f253722d26a82194803ade5a2c
# via celery
bleach==6.1.0 \
--hash=sha256:0a31f1837963c41d46bbf1331b8778e1308ea0791db03cc4e7357b97cf42a8fe \
@ -48,9 +48,9 @@ cachetools==5.3.3 \
--hash=sha256:0abad1021d3f8325b2fc1d2e9c8b9c9d57b04c3932657a72465447332c24d945 \
--hash=sha256:ba29e2dfa0b8b556606f097407ed1aa62080ee108ab0dc5ec9d6a723a007d105
# via google-auth
celery==5.2.6 \
--hash=sha256:d1398cadf30f576266b34370e28e880306ec55f7a4b6307549b0ae9c15663481 \
--hash=sha256:da31f8eae7607b1582e5ee2d3f2d6f58450585afd23379491e3d9229d08102d0
celery==5.4.0 \
--hash=sha256:369631eb580cf8c51a82721ec538684994f8277637edde2dfc0dacd73ed97f64 \
--hash=sha256:504a19140e8d3029d5acad88330c541d4c3f64c789d85f94756762d8bca7e706
# via -r requirements/default.in
certifi==2024.2.2 \
--hash=sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f \
@ -338,10 +338,6 @@ django-pipeline==3.0.0 \
--hash=sha256:49a8bee298668100bb6e8a2144dff8c607baa5297820a2503793c38693f34103 \
--hash=sha256:e9e08b084ef3ebf599795510519a8d44f2240b487782bebf4a8fcaf6302c31d1
# via -r requirements/default.in
exceptiongroup==1.2.0 \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68
# via anyio
fluent-syntax==0.19.0 \
--hash=sha256:920326d7f46864b9758f0044e9968e3112198bc826acee16ddd8f11d359004fd \
--hash=sha256:b352b3475fac6c6ed5f06527921f432aac073d764445508ee5218aeccc7cc5c4
@ -895,10 +891,12 @@ python-binary-memcached==0.31.2 \
--hash=sha256:290f70451e277df6a39aa0eea3cb6ca2eefcf5d601f957cf2ec1d353d7676c03 \
--hash=sha256:e5b93d54429e835cab7d5b33988649f9748344aa49adaed8eed94b37e714d562
# via django-bmemcached
python-dateutil==2.8.1 \
--hash=sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c \
--hash=sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a
# via -r requirements/default.in
python-dateutil==2.9.0 \
--hash=sha256:78e73e19c63f5b20ffa567001531680d939dc042bf7850431877645523c66709 \
--hash=sha256:cbf2f1da5e6083ac2fbfd4da39a25f34312230110440f424a14c7558bb85d82e
# via
# -r requirements/default.in
# celery
python-dotenv==0.17.0 \
--hash=sha256:471b782da0af10da1a80341e8438fca5fadeba2881c54360d5fd8d03d03a4f4a \
--hash=sha256:49782a97c9d641e8a09ae1d9af0856cc587c8d2474919342d5104d85be9890b2
@ -915,7 +913,6 @@ pytz==2022.1 \
--hash=sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c
# via
# apscheduler
# celery
# django-notifications-hq
raygun4py==4.3.0 \
--hash=sha256:9a675da0215df310a929ef8fe4f9f6c7882b3ee44a925d73e5c191fd962d7c4d
@ -1094,13 +1091,15 @@ typing-extensions==4.11.0 \
--hash=sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0 \
--hash=sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a
# via
# anyio
# asgiref
# dj-database-url
# fluent-syntax
# openai
# pydantic
# pydantic-core
tzdata==2024.1 \
--hash=sha256:2674120f8d891909751c38abcdfd386ac0a5a1127954fbc332af6b5ceae07efd \
--hash=sha256:9068bc196136463f5245e51efda838afa15aaeca9903f49050dfa2679db4d252
# via celery
tzlocal==5.2 \
--hash=sha256:49816ef2fe65ea8ac19d19aa7a1ae0551c834303d5014c6d5a62e4cbda8047b8 \
--hash=sha256:8d399205578f1a9342816409cc1e46a93ebd5755e39ea2d85334bea911bf0e6e

Просмотреть файл

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# ./docker/compile_requirements.sh
@ -60,19 +60,6 @@ sqlparse==0.4.4 \
# -c requirements/default.txt
# django
# django-debug-toolbar
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via
# build
# pip-tools
# pyproject-hooks
typing-extensions==4.11.0 \
--hash=sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0 \
--hash=sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a
# via
# -c requirements/default.txt
# asgiref
wheel==0.43.0 \
--hash=sha256:465ef92c69fa5c5da2d1cf8ac40559a8c940886afcef87dcf14b9470862f1d85 \
--hash=sha256:55c570405f142630c6b9f72fe09d9b67cf1477fcf543ae5b8dcb1f5b7377da81

Просмотреть файл

@ -16,4 +16,4 @@
# -------------------------------------------------------------------------------------------------
black==22.12.0
flake8==3.7.7
pyupgrade==2.10.0
pyupgrade==3.15.2

Просмотреть файл

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# ./docker/compile_requirements.sh
@ -54,15 +54,11 @@ pyflakes==2.1.1 \
--hash=sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0 \
--hash=sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2
# via flake8
pyupgrade==2.10.0 \
--hash=sha256:601427033f280d50b5b102fed1013b96f91244777772114aeb7e191762cd6050 \
--hash=sha256:b26a00db6e2d745fe5a949e1fd02c5286c3999edaf804f746c69d559c8f8b365
pyupgrade==3.15.2 \
--hash=sha256:c488d6896c546d25845712ef6402657123008d56c1063174e27aabe15bd6b4e5 \
--hash=sha256:ce309e0ff8ecb73f56a45f12570be84bbbde9540d13697cacb261a7f595fb1f5
# via -r requirements/lint.in
tokenize-rt==5.2.0 \
--hash=sha256:9fe80f8a5c1edad2d3ede0f37481cc0cc1538a2f442c9c2f9e4feacd2792d054 \
--hash=sha256:b79d41a65cfec71285433511b50271b05da3584a1da144a0752e9c621a285289
# via pyupgrade
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via black

Просмотреть файл

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# ./docker/compile_requirements.sh
@ -159,12 +159,6 @@ coverage[toml]==7.2.5 \
# via
# -r requirements/test.in
# pytest-cov
exceptiongroup==1.2.0 \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68
# via
# -c requirements/default.txt
# pytest
factory-boy==3.2.1 \
--hash=sha256:a98d277b0c047c75eb6e4ab8508a7f81fb03d2cb21986f627913546ef7a2a55e \
--hash=sha256:eb02a7dd1b577ef606b75a253b9818e6f9eaf996d94449c9d5ebb124f90dc795
@ -206,9 +200,9 @@ pytest-django==4.5.2 \
--hash=sha256:c60834861933773109334fe5a53e83d1ef4828f2203a1d6a0fa9972f4f75ab3e \
--hash=sha256:d9076f759bb7c36939dbdd5ae6633c18edfc2902d1a69fdbefd2426b970ce6c2
# via -r requirements/test.in
python-dateutil==2.8.1 \
--hash=sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c \
--hash=sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a
python-dateutil==2.9.0 \
--hash=sha256:78e73e19c63f5b20ffa567001531680d939dc042bf7850431877645523c66709 \
--hash=sha256:cbf2f1da5e6083ac2fbfd4da39a25f34312230110440f424a14c7558bb85d82e
# via
# -c requirements/default.txt
# faker
@ -229,13 +223,6 @@ six==1.16.0 \
# -c requirements/default.txt
# python-dateutil
# requests-mock
tomli==2.0.1 \
--hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \
--hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
# via
# -c requirements/lint.txt
# coverage
# pytest
urllib3==2.2.1 \
--hash=sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d \
--hash=sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19

Просмотреть файл

@ -1 +1 @@
python-3.10.14
python-3.11.9