Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Commit a9870c1

Browse files
authored
Add support for Python 3.13 (#985)
* Run tests under 3.13.0-rc2 * Work around lack of wheels for some packages * Use newer gevent on Python 3.13 * Use Python 3.13 final * Add legacy-cgi package on Python>=3.13 * Require grpcio>=1.66.2 on 3.13 * Require gevent>=24.10.3 on 3.13 * poetry lock --no-update * poetry update pylint * Upgrade psycopg2 * Require newer confluent-kafka on Python 3.13 * Ignore mypy error * Add pylint import-error disable for collections.abc Workaround for pylint-dev/pylint#10112 * Upgrade some pytest-related packages * Fix some tests broken by package upgrades * Fix missing teardown functions in cassandra tests These caused tests to hang under Python 3.13. * Remove now-unnecessary workarounds for packages without wheels * poetry update * Remove now-unnecessary "type: ignore" comment
1 parent f2bcca5 commit a9870c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+762
-731
lines changed

.github/workflows/python-package.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: ['3.9', '3.10', '3.11', '3.12']
15+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1616

1717
container:
1818
image: python:${{ matrix.python-version }}
@@ -37,6 +37,14 @@ jobs:
3737
restore-keys: |
3838
${{ runner.os }}-poetry-
3939
40+
# TODO(ckuehl|2024-09-26): Remove this once Python 3.13 wheels are
41+
# available for our dependencies.
42+
- name: Install temporary Python 3.13 build dependencies
43+
if: ${{ matrix.python-version == '3.13' }}
44+
run: |
45+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
46+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
47+
4048
- name: Update PATH
4149
run: 'echo "$HOME/.local/bin" >> "$GITHUB_PATH"'
4250

@@ -45,7 +53,7 @@ jobs:
4553
CASS_DRIVER_NO_EXTENSIONS: theytaketoolongtobuild
4654
run: |
4755
pip install pipx
48-
pipx install poetry==1.8.2
56+
pipx install poetry==1.8.3
4957
make .venv
5058
5159
- name: Lint

.github/workflows/python-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
- name: Install dependencies
2424
run: |
25-
pipx install poetry==1.8.2
25+
pipx install poetry==1.8.3
2626
2727
- name: Build and publish
2828
env:

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
FROM ghcr.io/reddit/thrift-compiler:0.19.0 AS thrift
22

3-
FROM python:3.12
3+
FROM public.ecr.aws/docker/library/python:3.13
4+
5+
# This is needed for pendulum due to no wheel: https://github.com/sdispater/pendulum/issues/844
6+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
7+
ENV PATH="/root/.cargo/bin:$PATH"
48

59
COPY --from=thrift /usr/local/bin/thrift /usr/local/bin/thrift
610

711
WORKDIR /src
812

913
RUN python -m venv /tmp/poetry && \
10-
/tmp/poetry/bin/pip install poetry==1.8.2 && \
14+
/tmp/poetry/bin/pip install poetry==1.8.3 && \
1115
ln -s /tmp/poetry/bin/poetry /usr/local/bin/poetry
1216

13-
COPY pyproject.toml poetry.lock ./
17+
COPY pyproject.toml poetry.lock README.md ./
1418
RUN poetry install --all-extras
1519

1620
CMD ["/bin/bash"]

baseplate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import os
33
import random
4-
from collections.abc import Iterator
4+
from collections.abc import Iterator # pylint: disable=import-error
55
from contextlib import contextmanager
66
from types import TracebackType
77
from typing import Any, Callable, NamedTuple, Optional

baseplate/clients/cassandra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
import time
3-
from collections.abc import Mapping, Sequence
3+
from collections.abc import Mapping, Sequence # pylint: disable=import-error
44
from threading import Event
55
from typing import (
66
TYPE_CHECKING,

baseplate/clients/memcache/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from collections.abc import Iterable, Sequence
1+
from collections.abc import Iterable, Sequence # pylint: disable=import-error
22
from time import perf_counter
33
from typing import Any, Callable, Optional, Union
44

baseplate/clients/sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import re
44
import typing
5-
from collections.abc import Sequence
5+
from collections.abc import Sequence # pylint: disable=import-error
66
from time import perf_counter
77
from typing import Any, Optional, Union
88

baseplate/clients/thrift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import time
77
from collections import OrderedDict
8-
from collections.abc import Iterator
8+
from collections.abc import Iterator # pylint: disable=import-error
99
from math import ceil
1010
from typing import Any, Callable, Optional
1111

baseplate/frameworks/pyramid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import sys
44
import time
5-
from collections.abc import Iterable, Iterator, Mapping
5+
from collections.abc import Iterable, Iterator, Mapping # pylint: disable=import-error
66
from typing import Any, Callable, Optional
77

88
import pyramid.events

baseplate/frameworks/queue_consumer/kafka.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import queue
44
import socket
55
import time
6-
from collections.abc import Sequence
6+
from collections.abc import Sequence # pylint: disable=import-error
77
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional
88

99
import confluent_kafka

baseplate/frameworks/queue_consumer/kombu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import queue
33
import socket
44
import time
5-
from collections.abc import Sequence
5+
from collections.abc import Sequence # pylint: disable=import-error
66
from enum import Enum
77
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional
88

baseplate/frameworks/thrift/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import random
33
import sys
44
import time
5-
from collections.abc import Iterator, Mapping
5+
from collections.abc import Iterator, Mapping # pylint: disable=import-error
66
from contextlib import contextmanager
77
from logging import Logger
88
from typing import Any, Callable, Optional

baseplate/lib/_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import socket
88
import urllib.parse
9-
from collections.abc import Mapping
9+
from collections.abc import Mapping # pylint: disable=import-error
1010
from typing import Optional
1111

1212
import requests.adapters

baseplate/lib/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
import pwd
9494
import re
9595
import socket
96-
from collections.abc import Sequence
96+
from collections.abc import Sequence # pylint: disable=import-error
9797
from typing import (
9898
IO,
9999
Any,

baseplate/lib/propagator_redditb3_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from collections.abc import Iterable
2+
from collections.abc import Iterable # pylint: disable=import-error
33
from re import compile as re_compile
44
from typing import Any, Optional
55

baseplate/lib/propagator_redditb3_thrift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from collections.abc import Iterable
2+
from collections.abc import Iterable # pylint: disable=import-error
33
from re import compile as re_compile
44
from typing import Any, Optional
55

baseplate/lib/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import bisect
44
import random
55
import typing
6-
from collections.abc import Iterable
6+
from collections.abc import Iterable # pylint: disable=import-error
77
from typing import Callable, Generic, Optional, TypeVar
88

99
T = TypeVar("T")

baseplate/lib/retry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Policies for retrying an operation safely."""
22

33
import time
4-
from collections.abc import Iterator
4+
from collections.abc import Iterator # pylint: disable=import-error
55
from typing import Optional
66

77

baseplate/lib/secrets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import json
66
import logging
77
import os
8-
from collections.abc import Iterator
8+
from collections.abc import Iterator # pylint: disable=import-error
99
from pathlib import Path
1010
from typing import Any, NamedTuple, Optional, Protocol
1111

baseplate/lib/service_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020

2121
import json
22-
from collections.abc import Sequence
22+
from collections.abc import Sequence # pylint: disable=import-error
2323
from typing import IO, NamedTuple, Optional
2424

2525
from baseplate.lib.config import Endpoint, EndpointConfiguration

baseplate/lib/thrift_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import queue
2121
import socket
2222
import time
23-
from collections.abc import Generator
23+
from collections.abc import Generator # pylint: disable=import-error
2424
from typing import TYPE_CHECKING, Any, Optional
2525

2626
from thrift.protocol import THeaderProtocol

baseplate/lib/tracing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from collections.abc import Callable, Sequence
1+
from collections.abc import Callable, Sequence # pylint: disable=import-error
22
from typing import Any, Optional, Protocol
33

44
import gevent.pool

baseplate/server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import time
2323
import traceback
2424
import warnings
25-
from collections.abc import Mapping, MutableMapping, Sequence
25+
from collections.abc import Mapping, MutableMapping, Sequence # pylint: disable=import-error
2626
from dataclasses import dataclass
2727
from datetime import datetime
2828
from enum import Enum

baseplate/server/prometheus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import logging
1616
import os
1717
import sys
18-
from collections.abc import Iterable
18+
from collections.abc import Iterable # pylint: disable=import-error
1919
from typing import TYPE_CHECKING
2020

2121
from gevent.pywsgi import LoggingLogAdapter, WSGIServer

baseplate/server/queue_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import signal
99
import socket
1010
import uuid
11-
from collections.abc import Sequence
11+
from collections.abc import Sequence # pylint: disable=import-error
1212
from threading import Thread
1313
from typing import TYPE_CHECKING, Any, Callable
1414

baseplate/server/reloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import sys
1313
import threading
1414
import time
15-
from collections.abc import Iterator, Sequence
15+
from collections.abc import Iterator, Sequence # pylint: disable=import-error
1616
from typing import NoReturn
1717

1818
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)