Skip to content

Commit

Permalink
✨ Support Python 3.13 and drop 3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy authored and migduroli committed Oct 24, 2024
1 parent 0b40328 commit 8343dc6
Show file tree
Hide file tree
Showing 6 changed files with 1,636 additions and 1,551 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

env:
DEFAULT_LINUX: "slim"
DEFAULT_PYTHON: "3.12"
DEFAULT_PYTHON: "3.13"
DEFAULT_SCHEMAS: "pydantic"

jobs:
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
container:
image: python:${{ matrix.python }}
steps:
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
strategy:
matrix:
linux: ["slim"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
schemas: ["pydantic", "marshmallow", "typesystem"]
steps:
- name: Check out the repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_pull_request_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
container:
image: python:${{ matrix.python }}
steps:
Expand Down
14 changes: 1 addition & 13 deletions flama/concurrency.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
import sys
import typing as t

if sys.version_info < (3, 9): # PORT: Remove when stop supporting 3.8 # pragma: no cover
import contextvars

async def to_thread(func, /, *args, **kwargs):
return await asyncio.get_running_loop().run_in_executor(
None, functools.partial(contextvars.copy_context().run, func, *args, **kwargs)
)

asyncio.to_thread = to_thread # pyright: ignore

if sys.version_info < (3, 10): # PORT: Remove when stop supporting 3.9 # pragma: no cover
from typing_extensions import ParamSpec, TypeGuard

Expand Down Expand Up @@ -58,9 +48,7 @@ async def run(
if is_async(func):
return await func(*args, **kwargs)

return t.cast(
R, await asyncio.to_thread(func, *args, **kwargs) # PORT: Remove when stop supporting 3.8 # type: ignore
)
return t.cast(R, await asyncio.to_thread(func, *args, **kwargs))


if sys.version_info < (3, 11): # PORT: Remove when stop supporting 3.10 # pragma: no cover
Expand Down
Loading

0 comments on commit 8343dc6

Please sign in to comment.