Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #985

Merged
merged 22 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

container:
image: python:${{ matrix.python-version }}
Expand All @@ -37,6 +37,14 @@ jobs:
restore-keys: |
${{ runner.os }}-poetry-

# TODO(ckuehl|2024-09-26): Remove this once Python 3.13 wheels are
# available for our dependencies.
- name: Install temporary Python 3.13 build dependencies
if: ${{ matrix.python-version == '3.13' }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call me old fashioned, but it seems like a good idea to install a specific version and verify checksums.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 yeah how long do we expect this workaround to be in place?

echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"

- name: Update PATH
run: 'echo "$HOME/.local/bin" >> "$GITHUB_PATH"'

Expand All @@ -45,7 +53,7 @@ jobs:
CASS_DRIVER_NO_EXTENSIONS: theytaketoolongtobuild
run: |
pip install pipx
pipx install poetry==1.8.2
pipx install poetry==1.8.3
make .venv

- name: Lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: Install dependencies
run: |
pipx install poetry==1.8.2
pipx install poetry==1.8.3

- name: Build and publish
env:
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
FROM ghcr.io/reddit/thrift-compiler:0.19.0 AS thrift

FROM python:3.12
FROM public.ecr.aws/docker/library/python:3.13

# This is needed for pendulum due to no wheel: https://github.com/sdispater/pendulum/issues/844
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"

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

WORKDIR /src

RUN python -m venv /tmp/poetry && \
/tmp/poetry/bin/pip install poetry==1.8.2 && \
/tmp/poetry/bin/pip install poetry==1.8.3 && \
ln -s /tmp/poetry/bin/poetry /usr/local/bin/poetry

COPY pyproject.toml poetry.lock ./
COPY pyproject.toml poetry.lock README.md ./
RUN poetry install --all-extras

CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion baseplate/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import random
from collections.abc import Iterator
from collections.abc import Iterator # pylint: disable=import-error
from contextlib import contextmanager
from types import TracebackType
from typing import Any, Callable, NamedTuple, Optional
Expand Down
2 changes: 1 addition & 1 deletion baseplate/clients/cassandra.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import time
from collections.abc import Mapping, Sequence
from collections.abc import Mapping, Sequence # pylint: disable=import-error
from threading import Event
from typing import (
TYPE_CHECKING,
Expand Down
2 changes: 1 addition & 1 deletion baseplate/clients/memcache/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections.abc import Iterable, Sequence
from collections.abc import Iterable, Sequence # pylint: disable=import-error
from time import perf_counter
from typing import Any, Callable, Optional, Union

Expand Down
2 changes: 1 addition & 1 deletion baseplate/clients/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re
import typing
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from time import perf_counter
from typing import Any, Optional, Union

Expand Down
2 changes: 1 addition & 1 deletion baseplate/clients/thrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import time
from collections import OrderedDict
from collections.abc import Iterator
from collections.abc import Iterator # pylint: disable=import-error
from math import ceil
from typing import Any, Callable, Optional

Expand Down
2 changes: 1 addition & 1 deletion baseplate/frameworks/pyramid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import sys
import time
from collections.abc import Iterable, Iterator, Mapping
from collections.abc import Iterable, Iterator, Mapping # pylint: disable=import-error
from typing import Any, Callable, Optional

import pyramid.events
Expand Down
2 changes: 1 addition & 1 deletion baseplate/frameworks/queue_consumer/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import queue
import socket
import time
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional

import confluent_kafka
Expand Down
2 changes: 1 addition & 1 deletion baseplate/frameworks/queue_consumer/kombu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import queue
import socket
import time
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from enum import Enum
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional

Expand Down
2 changes: 1 addition & 1 deletion baseplate/frameworks/thrift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random
import sys
import time
from collections.abc import Iterator, Mapping
from collections.abc import Iterator, Mapping # pylint: disable=import-error
from contextlib import contextmanager
from logging import Logger
from typing import Any, Callable, Optional
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import socket
import urllib.parse
from collections.abc import Mapping
from collections.abc import Mapping # pylint: disable=import-error
from typing import Optional

import requests.adapters
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
import pwd
import re
import socket
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from typing import (
IO,
Any,
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/propagator_redditb3_http.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from collections.abc import Iterable
from collections.abc import Iterable # pylint: disable=import-error
from re import compile as re_compile
from typing import Any, Optional

Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/propagator_redditb3_thrift.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from collections.abc import Iterable
from collections.abc import Iterable # pylint: disable=import-error
from re import compile as re_compile
from typing import Any, Optional

Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import bisect
import random
import typing
from collections.abc import Iterable
from collections.abc import Iterable # pylint: disable=import-error
from typing import Callable, Generic, Optional, TypeVar

T = TypeVar("T")
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/retry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Policies for retrying an operation safely."""

import time
from collections.abc import Iterator
from collections.abc import Iterator # pylint: disable=import-error
from typing import Optional


Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import logging
import os
from collections.abc import Iterator
from collections.abc import Iterator # pylint: disable=import-error
from pathlib import Path
from typing import Any, NamedTuple, Optional, Protocol

Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/service_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""

import json
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from typing import IO, NamedTuple, Optional

from baseplate.lib.config import Endpoint, EndpointConfiguration
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/thrift_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import queue
import socket
import time
from collections.abc import Generator
from collections.abc import Generator # pylint: disable=import-error
from typing import TYPE_CHECKING, Any, Optional

from thrift.protocol import THeaderProtocol
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/tracing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections.abc import Callable, Sequence
from collections.abc import Callable, Sequence # pylint: disable=import-error
from typing import Any, Optional, Protocol

import gevent.pool
Expand Down
2 changes: 1 addition & 1 deletion baseplate/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import time
import traceback
import warnings
from collections.abc import Mapping, MutableMapping, Sequence
from collections.abc import Mapping, MutableMapping, Sequence # pylint: disable=import-error
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
Expand Down
2 changes: 1 addition & 1 deletion baseplate/server/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging
import os
import sys
from collections.abc import Iterable
from collections.abc import Iterable # pylint: disable=import-error
from typing import TYPE_CHECKING

from gevent.pywsgi import LoggingLogAdapter, WSGIServer
Expand Down
2 changes: 1 addition & 1 deletion baseplate/server/queue_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import signal
import socket
import uuid
from collections.abc import Sequence
from collections.abc import Sequence # pylint: disable=import-error
from threading import Thread
from typing import TYPE_CHECKING, Any, Callable

Expand Down
2 changes: 1 addition & 1 deletion baseplate/server/reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import threading
import time
from collections.abc import Iterator, Sequence
from collections.abc import Iterator, Sequence # pylint: disable=import-error
from typing import NoReturn

logger = logging.getLogger(__name__)
Expand Down
Loading
Loading