feat: lower Python requirement to 3.10#77
Open
flochtililoch wants to merge 1 commit intofishjam-cloud:mainfrom
Open
feat: lower Python requirement to 3.10#77flochtililoch wants to merge 1 commit intofishjam-cloud:mainfrom
flochtililoch wants to merge 1 commit intofishjam-cloud:mainfrom
Conversation
Replace asyncio.TaskGroup (Python 3.11+) in tests/test_notifier.py with asyncio.ensure_future and asyncio.gather, which are compatible with Python 3.10. Update requires-python in pyproject.toml and add 3.10 to the CI test matrix. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR lowers the minimum supported Python version for the published fishjam-server-sdk package to 3.10 by updating packaging metadata, expanding CI coverage to include Python 3.10, and removing Python 3.11-only asyncio.TaskGroup usage from notifier tests.
Changes:
- Lower
requires-pythoninpyproject.tomlfrom>=3.11to>=3.10. - Replace
asyncio.TaskGroupusage intests/test_notifier.pywith explicit task creation/cancellation. - Add Python 3.10 to the CI matrix for type-checking and tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pyproject.toml |
Lowers the SDK’s declared minimum Python version to 3.10. |
tests/test_notifier.py |
Removes TaskGroup to make tests runnable on Python 3.10. |
.github/workflows/ci.yml |
Adds Python 3.10 to the CI matrix for type-check and test jobs. |
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:36
python-version: ["3.10", ...]combined withuv sync --all-packageswill try to sync all uv workspace members, but several example projects inpyproject.toml's workspace still declarerequires-python = ">=3.11"(e.g.examples/transcription/pyproject.toml:6). This will likely make the 3.10 CI jobs fail during dependency resolution/installation. Consider either (a) adjusting the CI install step to sync only the main package (exclude--all-packages/ examples) for the library CI, or (b) lowering the example projects'requires-pythonand removing their 3.11-only code so the whole workspace is 3.10-compatible.
strategy: &strategy
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- name: Install project dependencies
run: uv sync --locked --all-extras --all-packages
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+83
to
+95
| notifier_task = asyncio.ensure_future(notifier.connect()) | ||
| await notifier.wait_ready() | ||
|
|
||
| assert ( | ||
| notifier._websocket | ||
| and notifier._websocket.state == websockets.State.OPEN | ||
| ) | ||
| assert ( | ||
| notifier._websocket | ||
| and notifier._websocket.state == websockets.State.OPEN | ||
| ) | ||
|
|
||
| notifier_task.cancel() | ||
| notifier_task.cancel() | ||
| try: | ||
| await notifier_task | ||
| except asyncio.CancelledError: | ||
| pass |
Comment on lines
+120
to
+135
| assert_task = asyncio.ensure_future(assert_events(notifier, event_checks.copy())) | ||
| notifier_task = asyncio.ensure_future(notifier.connect()) | ||
| await notifier.wait_ready() | ||
|
|
||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
|
|
||
| room_api.delete_room(room.id) | ||
| room_api.delete_room(room.id) | ||
|
|
||
| await assert_task | ||
| await assert_task | ||
|
|
||
| notifier_task.cancel() | ||
| notifier_task.cancel() | ||
| try: | ||
| await notifier_task | ||
| except asyncio.CancelledError: | ||
| pass |
Comment on lines
+152
to
+172
| assert_task = asyncio.ensure_future(assert_events(notifier, event_checks.copy())) | ||
| notifier_task = asyncio.ensure_future(notifier.connect()) | ||
| await notifier.wait_ready() | ||
|
|
||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
|
|
||
| peer, token = room_api.create_peer(room.id) | ||
| peer_socket = PeerSocket(fishjam_url=FISHJAM_ID) | ||
| peer_socket_task = tg.create_task(peer_socket.connect(token)) | ||
| peer, token = room_api.create_peer(room.id) | ||
| peer_socket = PeerSocket(fishjam_url=FISHJAM_ID) | ||
| peer_socket_task = asyncio.ensure_future(peer_socket.connect(token)) | ||
|
|
||
| await peer_socket.wait_ready() | ||
| await peer_socket.wait_ready() | ||
|
|
||
| room_api.delete_peer(room.id, peer.id) | ||
| room_api.delete_room(room.id) | ||
| room_api.delete_peer(room.id, peer.id) | ||
| room_api.delete_room(room.id) | ||
|
|
||
| await assert_task | ||
| await assert_task | ||
|
|
||
| notifier_task.cancel() | ||
| peer_socket_task.cancel() | ||
| notifier_task.cancel() | ||
| peer_socket_task.cancel() | ||
| await asyncio.gather(notifier_task, peer_socket_task, return_exceptions=True) |
Comment on lines
+188
to
+207
| assert_task = asyncio.ensure_future(assert_events(notifier, event_checks.copy())) | ||
| notifier_task = asyncio.ensure_future(notifier.connect()) | ||
| await notifier.wait_ready() | ||
|
|
||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
| _peer, token = room_api.create_peer(room.id) | ||
| options = RoomOptions(webhook_url=WEBHOOK_URL) | ||
| room = room_api.create_room(options=options) | ||
| _peer, token = room_api.create_peer(room.id) | ||
|
|
||
| peer_socket = PeerSocket(fishjam_url=FISHJAM_ID) | ||
| peer_socket_task = tg.create_task(peer_socket.connect(token)) | ||
| peer_socket = PeerSocket(fishjam_url=FISHJAM_ID) | ||
| peer_socket_task = asyncio.ensure_future(peer_socket.connect(token)) | ||
|
|
||
| await peer_socket.wait_ready() | ||
| await peer_socket.wait_ready() | ||
|
|
||
| room_api.delete_room(room.id) | ||
| room_api.delete_room(room.id) | ||
|
|
||
| await assert_task | ||
| await assert_task | ||
|
|
||
| notifier_task.cancel() | ||
| peer_socket_task.cancel() | ||
| notifier_task.cancel() | ||
| peer_socket_task.cancel() | ||
| await asyncio.gather(notifier_task, peer_socket_task, return_exceptions=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The minimum Python version was set to
>=3.11despite the main library code being fully compatible with Python 3.10. The only 3.11-specific construct in the repository wasasyncio.TaskGroup, which appeared exclusively intests/test_notifier.py.Changes
pyproject.toml: lowerrequires-pythonfrom>=3.11to>=3.10tests/test_notifier.py: replace allasyncio.TaskGroupusages withasyncio.ensure_future+asyncio.gather, which are available since Python 3.4 and 3.4 respectively.github/workflows/ci.yml: add"3.10"to the Python version matrix for bothtype-checkandtestjobsMotivation
Projects running Python 3.10 are currently blocked from upgrading past
fishjam-server-sdk==0.20.0. This change unblocks them without affecting any existing Python 3.11+ users.Made with Cursor