Skip to content

Commit eda735e

Browse files
Remove support for python 3.8 (#17908)
### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [X] Pull request is based on the develop branch * [X] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
1 parent e1f5da6 commit eda735e

23 files changed

+135
-113
lines changed

.ci/scripts/calculate_jobs.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def set_output(key: str, value: str):
3636
# First calculate the various trial jobs.
3737
#
3838
# For PRs, we only run each type of test with the oldest Python version supported (which
39-
# is Python 3.8 right now)
39+
# is Python 3.9 right now)
4040

4141
trial_sqlite_tests = [
4242
{
43-
"python-version": "3.8",
43+
"python-version": "3.9",
4444
"database": "sqlite",
4545
"extras": "all",
4646
}
@@ -53,12 +53,12 @@ def set_output(key: str, value: str):
5353
"database": "sqlite",
5454
"extras": "all",
5555
}
56-
for version in ("3.9", "3.10", "3.11", "3.12", "3.13")
56+
for version in ("3.10", "3.11", "3.12", "3.13")
5757
)
5858

5959
trial_postgres_tests = [
6060
{
61-
"python-version": "3.8",
61+
"python-version": "3.9",
6262
"database": "postgres",
6363
"postgres-version": "11",
6464
"extras": "all",
@@ -77,7 +77,7 @@ def set_output(key: str, value: str):
7777

7878
trial_no_extra_tests = [
7979
{
80-
"python-version": "3.8",
80+
"python-version": "3.9",
8181
"database": "sqlite",
8282
"extras": "",
8383
}
@@ -99,24 +99,24 @@ def set_output(key: str, value: str):
9999

100100
# First calculate the various sytest jobs.
101101
#
102-
# For each type of test we only run on focal on PRs
102+
# For each type of test we only run on bullseye on PRs
103103

104104

105105
sytest_tests = [
106106
{
107-
"sytest-tag": "focal",
107+
"sytest-tag": "bullseye",
108108
},
109109
{
110-
"sytest-tag": "focal",
110+
"sytest-tag": "bullseye",
111111
"postgres": "postgres",
112112
},
113113
{
114-
"sytest-tag": "focal",
114+
"sytest-tag": "bullseye",
115115
"postgres": "multi-postgres",
116116
"workers": "workers",
117117
},
118118
{
119-
"sytest-tag": "focal",
119+
"sytest-tag": "bullseye",
120120
"postgres": "multi-postgres",
121121
"workers": "workers",
122122
"reactor": "asyncio",
@@ -127,11 +127,11 @@ def set_output(key: str, value: str):
127127
sytest_tests.extend(
128128
[
129129
{
130-
"sytest-tag": "focal",
130+
"sytest-tag": "bullseye",
131131
"reactor": "asyncio",
132132
},
133133
{
134-
"sytest-tag": "focal",
134+
"sytest-tag": "bullseye",
135135
"postgres": "postgres",
136136
"reactor": "asyncio",
137137
},

.ci/scripts/prepare_old_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# this script is run by GitHub Actions in a plain `focal` container; it
2+
# this script is run by GitHub Actions in a plain `jammy` container; it
33
# - installs the minimal system requirements, and poetry;
44
# - patches the project definition file to refer to old versions only;
55
# - creates a venv with these old versions using poetry; and finally

.github/workflows/latest_deps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ jobs:
132132
fail-fast: false
133133
matrix:
134134
include:
135-
- sytest-tag: focal
135+
- sytest-tag: bullseye
136136

137-
- sytest-tag: focal
137+
- sytest-tag: bullseye
138138
postgres: postgres
139139
workers: workers
140140
redis: redis

.github/workflows/release-artifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
runs-on: ${{ matrix.os }}
103103
strategy:
104104
matrix:
105-
os: [ubuntu-20.04, macos-12]
105+
os: [ubuntu-22.04, macos-12]
106106
arch: [x86_64, aarch64]
107107
# is_pr is a flag used to exclude certain jobs from the matrix on PRs.
108108
# It is not read by the rest of the workflow.
@@ -144,7 +144,7 @@ jobs:
144144

145145
- name: Only build a single wheel on PR
146146
if: startsWith(github.ref, 'refs/pull/')
147-
run: echo "CIBW_BUILD="cp38-manylinux_${{ matrix.arch }}"" >> $GITHUB_ENV
147+
run: echo "CIBW_BUILD="cp39-manylinux_${{ matrix.arch }}"" >> $GITHUB_ENV
148148

149149
- name: Build wheels
150150
run: python -m cibuildwheel --output-dir wheelhouse

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ jobs:
397397
needs:
398398
- linting-done
399399
- changes
400-
runs-on: ubuntu-20.04
400+
runs-on: ubuntu-22.04
401401
steps:
402402
- uses: actions/checkout@v4
403403

@@ -409,12 +409,12 @@ jobs:
409409
# their build dependencies
410410
- run: |
411411
sudo apt-get -qq update
412-
sudo apt-get -qq install build-essential libffi-dev python-dev \
412+
sudo apt-get -qq install build-essential libffi-dev python3-dev \
413413
libxml2-dev libxslt-dev xmlsec1 zlib1g-dev libjpeg-dev libwebp-dev
414414
415415
- uses: actions/setup-python@v5
416416
with:
417-
python-version: '3.8'
417+
python-version: '3.9'
418418

419419
- name: Prepare old deps
420420
if: steps.cache-poetry-old-deps.outputs.cache-hit != 'true'
@@ -458,7 +458,7 @@ jobs:
458458
runs-on: ubuntu-latest
459459
strategy:
460460
matrix:
461-
python-version: ["pypy-3.8"]
461+
python-version: ["pypy-3.9"]
462462
extras: ["all"]
463463

464464
steps:
@@ -580,7 +580,7 @@ jobs:
580580
strategy:
581581
matrix:
582582
include:
583-
- python-version: "3.8"
583+
- python-version: "3.9"
584584
postgres-version: "11"
585585

586586
- python-version: "3.11"

.github/workflows/twisted_trunk.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ jobs:
9999
if: needs.check_repo.outputs.should_run_workflow == 'true'
100100
runs-on: ubuntu-latest
101101
container:
102-
# We're using ubuntu:focal because it uses Python 3.8 which is our minimum supported Python version.
102+
# We're using debian:bullseye because it uses Python 3.9 which is our minimum supported Python version.
103103
# This job is a canary to warn us about unreleased twisted changes that would cause problems for us if
104104
# they were to be released immediately. For simplicity's sake (and to save CI runners) we use the oldest
105105
# version, assuming that any incompatibilities on newer versions would also be present on the oldest.
106-
image: matrixdotorg/sytest-synapse:focal
106+
image: matrixdotorg/sytest-synapse:bullseye
107107
volumes:
108108
- ${{ github.workspace }}:/src
109109

changelog.d/17908.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove support for python 3.8.

docs/development/contributing_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ The following command will let you run the integration test with the most common
322322
configuration:
323323
324324
```sh
325-
$ docker run --rm -it -v /path/where/you/have/cloned/the/repository\:/src:ro -v /path/to/where/you/want/logs\:/logs matrixdotorg/sytest-synapse:focal
325+
$ docker run --rm -it -v /path/where/you/have/cloned/the/repository\:/src:ro -v /path/to/where/you/want/logs\:/logs matrixdotorg/sytest-synapse:bullseye
326326
```
327327
(Note that the paths must be full paths! You could also write `$(realpath relative/path)` if needed.)
328328

docs/setup/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ When following this route please make sure that the [Platform-specific prerequis
208208
System requirements:
209209

210210
- POSIX-compliant system (tested on Linux & OS X)
211-
- Python 3.8 or later, up to Python 3.11.
211+
- Python 3.9 or later, up to Python 3.13.
212212
- At least 1GB of free RAM if you want to join large public rooms like #matrix:matrix.org
213213

214214
If building on an uncommon architecture for which pre-built wheels are

docs/upgrade.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ each upgrade are complete before moving on to the next upgrade, to avoid
117117
stacking them up. You can monitor the currently running background updates with
118118
[the Admin API](usage/administration/admin_api/background_updates.html#status).
119119
120+
# Upgrading to v1.119.0
121+
122+
## Minimum supported Python version
123+
124+
The minimum supported Python version has been increased from v3.8 to v3.9.
125+
You will need Python 3.9+ to run Synapse v1.119.0 (due out Nov 7th, 2024).
126+
127+
If you use current versions of the Matrix.org-distributed Docker images, no action is required.
128+
Please note that support for Ubuntu `focal` was dropped as well since it uses Python 3.8.
129+
130+
120131
# Upgrading to v1.111.0
121132
122133
## New worker endpoints for authenticated client and federation media

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ strict_equality = True
2626

2727
# Run mypy type checking with the minimum supported Python version to catch new usage
2828
# that isn't backwards-compatible (types, overloads, etc).
29-
python_version = 3.8
29+
python_version = 3.9
3030

3131
files =
3232
docker/,

poetry.lock

Lines changed: 3 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
[tool.ruff]
3838
line-length = 88
39-
target-version = "py38"
39+
target-version = "py39"
4040

4141
[tool.ruff.lint]
4242
# See https://beta.ruff.rs/docs/rules/#error-e
@@ -155,7 +155,7 @@ synapse_review_recent_signups = "synapse._scripts.review_recent_signups:main"
155155
update_synapse_database = "synapse._scripts.update_synapse_database:main"
156156

157157
[tool.poetry.dependencies]
158-
python = "^3.8.0"
158+
python = "^3.9.0"
159159

160160
# Mandatory Dependencies
161161
# ----------------------
@@ -178,7 +178,7 @@ Twisted = {extras = ["tls"], version = ">=18.9.0"}
178178
treq = ">=15.1"
179179
# Twisted has required pyopenssl 16.0 since about Twisted 16.6.
180180
pyOpenSSL = ">=16.0.0"
181-
PyYAML = ">=3.13"
181+
PyYAML = ">=5.3"
182182
pyasn1 = ">=0.1.9"
183183
pyasn1-modules = ">=0.0.7"
184184
bcrypt = ">=3.1.7"
@@ -241,7 +241,7 @@ authlib = { version = ">=0.15.1", optional = true }
241241
# `contrib/systemd/log_config.yaml`.
242242
# Note: systemd-python 231 appears to have been yanked from pypi
243243
systemd-python = { version = ">=231", optional = true }
244-
lxml = { version = ">=4.2.0", optional = true }
244+
lxml = { version = ">=4.5.2", optional = true }
245245
sentry-sdk = { version = ">=0.7.2", optional = true }
246246
opentracing = { version = ">=2.2.0", optional = true }
247247
jaeger-client = { version = ">=4.0.0", optional = true }
@@ -378,13 +378,13 @@ build-backend = "poetry.core.masonry.api"
378378
# Skip unsupported platforms (by us or by Rust).
379379
# See https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip for the list of build targets.
380380
# We skip:
381-
# - CPython 3.6 and 3.7: EOLed
382-
# - PyPy 3.7: we only support Python 3.8+
381+
# - CPython 3.6, 3.7 and 3.8: EOLed
382+
# - PyPy 3.7 and 3.8: we only support Python 3.9+
383383
# - musllinux i686: excluded to reduce number of wheels we build.
384384
# c.f. https://github.com/matrix-org/synapse/pull/12595#discussion_r963107677
385385
# - PyPy on Aarch64 and musllinux on aarch64: too slow to build.
386386
# c.f. https://github.com/matrix-org/synapse/pull/14259
387-
skip = "cp36* cp37* pp37* *-musllinux_i686 pp*aarch64 *-musllinux_aarch64"
387+
skip = "cp36* cp37* cp38* pp37* pp38* *-musllinux_i686 pp*aarch64 *-musllinux_aarch64"
388388

389389
# We need a rust compiler
390390
before-all = "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y --profile minimal"

scripts-dev/build_debian_packages.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
# example)
2929
DISTS = (
3030
"debian:bullseye", # (EOL ~2024-07) (our EOL forced by Python 3.9 is 2025-10-05)
31-
"debian:bookworm", # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)
32-
"debian:sid", # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24)
33-
"ubuntu:focal", # 20.04 LTS (EOL 2025-04) (our EOL forced by Python 3.8 is 2024-10-14)
31+
"debian:bookworm", # (EOL 2026-06) (our EOL forced by Python 3.11 is 2027-10-24)
32+
"debian:sid", # (rolling distro, no EOL)
3433
"ubuntu:jammy", # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04)
3534
"ubuntu:noble", # 24.04 LTS (EOL 2029-06)
3635
"ubuntu:oracular", # 24.10 (EOL 2025-07)

synapse/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
# Note that we use an (unneeded) variable here so that pyupgrade doesn't nuke the
4040
# if-statement completely.
4141
py_version = sys.version_info
42-
if py_version < (3, 8):
43-
print("Synapse requires Python 3.8 or above.")
42+
if py_version < (3, 9):
43+
print("Synapse requires Python 3.9 or above.")
4444
sys.exit(1)
4545

4646
# Allow using the asyncio reactor via env var.

synapse/storage/databases/main/room.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,7 +2550,9 @@ async def clear_partial_state_room(self, room_id: str) -> Optional[int]:
25502550
still contains events with partial state.
25512551
"""
25522552
try:
2553-
async with self._un_partial_stated_rooms_stream_id_gen.get_next() as un_partial_state_room_stream_id:
2553+
async with (
2554+
self._un_partial_stated_rooms_stream_id_gen.get_next() as un_partial_state_room_stream_id
2555+
):
25542556
await self.db_pool.runInteraction(
25552557
"clear_partial_state_room",
25562558
self._clear_partial_state_room_txn,

0 commit comments

Comments
 (0)