Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 9006ee3

Browse files
authored
Drop support for and remove references to EOL Python 3.6 (#11683)
* remove reference in comments to python3.6 * upgrade tox python env in script * bump python version in example for completeness * upgrade python version requirement in setup doc * upgrade necessary python version in __init__.py * upgrade python version in setup.py * newsfragment * drops refs to bionic and replace with focal * bump refs to postgres 9.6 to 10 * fix hanging ci * try installing tzdata first * revert change made in b979f33 * ignore new random mypy error while debugging other error * fix lint error for temporary workaround * revert change to install list * try passing env var * export debian frontend var? * move line and add comment * bump pillow dependency * bump lxml depenency * install libjpeg-dev for pillow * bump automat version to one compatible with py3.8 * add libwebp for pillow * bump twisted trunk python version * change suffix of newsfragment * remove redundant python 3.7 checks * lint
1 parent f8cf02b commit 9006ee3

File tree

13 files changed

+25
-28
lines changed

13 files changed

+25
-28
lines changed

.ci/scripts/test_old_deps.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env bash
2-
3-
# this script is run by GitHub Actions in a plain `bionic` container; it installs the
2+
# this script is run by GitHub Actions in a plain `focal` container; it installs the
43
# minimal requirements for tox and hands over to the py3-old tox environment.
54

5+
# Prevent tzdata from asking for user input
6+
export DEBIAN_FRONTEND=noninteractive
7+
68
set -ex
79

810
apt-get update
9-
apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
11+
apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox libjpeg-dev libwebp-dev
1012

1113
export LANG="C.UTF-8"
1214

.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ jobs:
141141
steps:
142142
- uses: actions/checkout@v2
143143
- name: Test with old deps
144-
uses: docker://ubuntu:bionic # For old python and sqlite
144+
uses: docker://ubuntu:focal # For old python and sqlite
145145
with:
146146
workdir: /github/workspace
147147
entrypoint: .ci/scripts/test_old_deps.sh
@@ -213,15 +213,15 @@ jobs:
213213
fail-fast: false
214214
matrix:
215215
include:
216-
- sytest-tag: bionic
216+
- sytest-tag: focal
217217

218-
- sytest-tag: bionic
218+
- sytest-tag: focal
219219
postgres: postgres
220220

221221
- sytest-tag: testing
222222
postgres: postgres
223223

224-
- sytest-tag: bionic
224+
- sytest-tag: focal
225225
postgres: multi-postgres
226226
workers: workers
227227

.github/workflows/twisted_trunk.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- run: sudo apt-get -qq install xmlsec1
2626
- uses: actions/setup-python@v2
2727
with:
28-
python-version: 3.6
28+
python-version: 3.7
2929
- run: .ci/patch_for_twisted_trunk.sh
3030
- run: pip install tox
3131
- run: tox -e py

changelog.d/11683.removal

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop support for Python 3.6, which is EOL.

docker/Dockerfile-pgtests

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Use the Sytest image that comes with a lot of the build dependencies
22
# pre-installed
3-
FROM matrixdotorg/sytest:bionic
3+
FROM matrixdotorg/sytest:focal
44

55
# The Sytest image doesn't come with python, so install that
66
RUN apt-get update && apt-get -qq install -y python3 python3-dev python3-pip

docker/run_pg_tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl -w -D /var/lib/postgresql/dat
1616
# Run the tests
1717
cd /src
1818
export TRIAL_FLAGS="-j 4"
19-
tox --workdir=./.tox-pg-container -e py36-postgres "$@"
19+
tox --workdir=./.tox-pg-container -e py37-postgres "$@"

docs/admin_api/version_api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ It returns a JSON body like the following:
1616
```json
1717
{
1818
"server_version": "0.99.2rc1 (b=develop, abcdef123)",
19-
"python_version": "3.6.8"
19+
"python_version": "3.7.8"
2020
}
2121
```

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def exec_file(path_segments):
150150
zip_safe=False,
151151
long_description=long_description,
152152
long_description_content_type="text/x-rst",
153-
python_requires="~=3.6",
153+
python_requires="~=3.7",
154154
entry_points={
155155
"console_scripts": [
156156
"synapse_homeserver = synapse.app.homeserver:main",

synapse/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import sys
2222

2323
# Check that we're not running on an unsupported Python version.
24-
if sys.version_info < (3, 6):
25-
print("Synapse requires Python 3.6 or above.")
24+
if sys.version_info < (3, 7):
25+
print("Synapse requires Python 3.7 or above.")
2626
sys.exit(1)
2727

2828
# Twisted and canonicaljson will fail to import when this file is executed to

synapse/app/_base.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import gc
1717
import logging
1818
import os
19-
import platform
2019
import signal
2120
import socket
2221
import sys
@@ -468,16 +467,12 @@ def run_sighup(*args: Any, **kwargs: Any) -> None:
468467
# everything currently allocated are things that will be used for the
469468
# rest of time. Doing so means less work each GC (hopefully).
470469
#
471-
# This only works on Python 3.7
472-
if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
473-
gc.collect()
474-
gc.freeze()
470+
gc.collect()
471+
gc.freeze()
475472

476473
# Speed up shutdowns by freezing all allocated objects. This moves everything
477474
# into the permanent generation and excludes them from the final GC.
478-
# Unfortunately only works on Python 3.7
479-
if platform.python_implementation() == "CPython" and sys.version_info >= (3, 7):
480-
atexit.register(gc.freeze)
475+
atexit.register(gc.freeze)
481476

482477

483478
def setup_sentry(hs: "HomeServer") -> None:

synapse/python_dependencies.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"pyasn1>=0.1.9",
7171
"pyasn1-modules>=0.0.7",
7272
"bcrypt>=3.1.0",
73-
"pillow>=4.3.0",
73+
"pillow>=5.4.0",
7474
"sortedcontainers>=1.4.4",
7575
"pymacaroons>=0.13.0",
7676
"msgpack>=0.5.2",
@@ -107,7 +107,7 @@
107107
# `systemd.journal.JournalHandler`, as is documented in
108108
# `contrib/systemd/log_config.yaml`.
109109
"systemd": ["systemd-python>=231"],
110-
"url_preview": ["lxml>=3.5.0"],
110+
"url_preview": ["lxml>=4.2.0"],
111111
"sentry": ["sentry-sdk>=0.7.2"],
112112
"opentracing": ["jaeger-client>=4.0.0", "opentracing>=2.2.0"],
113113
"jwt": ["pyjwt>=1.6.4"],

synapse/storage/engines/postgres.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def check_database(self, db_conn, allow_outdated_version: bool = False):
4646
self._version = db_conn.server_version
4747

4848
# Are we on a supported PostgreSQL version?
49-
if not allow_outdated_version and self._version < 90600:
50-
raise RuntimeError("Synapse requires PostgreSQL 9.6 or above.")
49+
if not allow_outdated_version and self._version < 100000:
50+
raise RuntimeError("Synapse requires PostgreSQL 10 or above.")
5151

5252
with db_conn.cursor() as txn:
5353
txn.execute("SHOW SERVER_ENCODING")

tox.ini

+1-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ usedevelop=true
117117
skip_install = true
118118
usedevelop = false
119119
deps =
120-
# Old automat version for Twisted
121-
Automat == 0.3.0
120+
Automat == 0.8.0
122121
lxml
123122
{[base]deps}
124123

0 commit comments

Comments
 (0)