Skip to content

Commit aabaa89

Browse files
authored
Drop Python 3.8 support; upgrade websockets lib to v15 (#605)
1 parent 5def4b5 commit aabaa89

File tree

11 files changed

+102
-151
lines changed

11 files changed

+102
-151
lines changed

.github/workflows/codegen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Set up Python.
3535
uses: actions/setup-python@v4
3636
with:
37-
python-version: '3.8'
37+
python-version: '3.9'
3838

3939
- name: Setup Poetry.
4040
uses: snok/install-poetry@v1

.github/workflows/publish_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Setup Python.
3333
uses: actions/setup-python@v4
3434
with:
35-
python-version: 3.8
35+
python-version: 3.9
3636

3737
- name: Setup Poetry.
3838
uses: snok/install-poetry@v1

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Python.
2525
uses: actions/setup-python@v4
2626
with:
27-
python-version: 3.8
27+
python-version: 3.9
2828

2929
- name: Run linter check.
3030
uses: astral-sh/ruff-action@v3

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: [ macos-latest, ubuntu-latest, windows-latest ]
13-
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
13+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1414

1515
runs-on: ${{matrix.os}}
1616

.github/workflows/update_lexicons.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Set up Python.
2929
uses: actions/setup-python@v4
3030
with:
31-
python-version: '3.8'
31+
python-version: '3.9'
3232

3333
- name: Setup Poetry.
3434
uses: snok/install-poetry@v1

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2
77
build:
88
os: ubuntu-20.04
99
tools:
10-
python: "3.8"
10+
python: "3.9"
1111
jobs:
1212
post_create_environment:
1313
- python -m pip install poetry

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ This SDK attempts to implement everything that provides ATProto. There is suppor
8383

8484
### Requirements
8585

86-
- Python 3.8 or higher.
86+
- Python 3.9 or higher.
8787

8888
### Installing
8989

docs/source/readme.content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This SDK attempts to implement everything that provides ATProto. There is suppor
44

55
### Requirements
66

7-
- Python 3.8 or higher.
7+
- Python 3.9 or higher.
88

99
### Installing
1010

packages/atproto_firehose/client.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from atproto_client.models.base import ParamsModelBase
1212
from atproto_client.models.common import XrpcError
1313
from atproto_core.exceptions import DAGCBORDecodingError
14-
from websockets.client import connect as aconnect
14+
from websockets.asyncio.client import connect as aconnect
1515
from websockets.exceptions import (
1616
ConnectionClosedError,
1717
ConnectionClosedOK,
@@ -46,8 +46,8 @@
4646

4747

4848
if t.TYPE_CHECKING:
49-
from websockets.client import ClientConnection as SyncWebSocketClient
50-
from websockets.legacy.client import Connect as AsyncConnect
49+
from websockets.asyncio.client import connect as AsyncConnect
50+
from websockets.sync.client import ClientConnection as SyncWebSocketClient
5151

5252

5353
def _build_websocket_uri(method: str, base_uri: str, params: t.Optional[t.Dict[str, t.Any]] = None) -> str:
@@ -124,9 +124,18 @@ def _websocket_uri(self) -> str:
124124
return _build_websocket_uri(self._method, self._base_uri, self._params)
125125

126126
def _get_client(self) -> 'SyncWebSocketClient':
127-
return connect(self._websocket_uri, max_size=_MAX_MESSAGE_SIZE_BYTES, close_timeout=0.1)
127+
# Disable automatic pings for sync client (added in websockets v15+)
128+
# to maintain behavior consistent with <v14 for now.
129+
return connect(
130+
self._websocket_uri,
131+
max_size=_MAX_MESSAGE_SIZE_BYTES,
132+
close_timeout=0.1,
133+
# see https://websockets.readthedocs.io/en/stable/topics/keepalive.html
134+
ping_interval=None, # Disable automatic pings
135+
)
128136

129137
def _get_async_client(self) -> 'AsyncConnect':
138+
# Async client connect function accepts ping_interval directly (default is 20s)
130139
return aconnect(self._websocket_uri, max_size=_MAX_MESSAGE_SIZE_BYTES, close_timeout=0.1)
131140

132141
def _get_reconnection_delay(self) -> int:

poetry.lock

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

0 commit comments

Comments
 (0)