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

🐛 Fix Python3.11+ raises ModuleNotFoundError: No module named typing_extensions #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion asyncer/_compat.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# AnyIO 4.1.0 renamed cancellable to abandon_on_cancel
import importlib
import importlib.metadata
import sys
from typing import Callable, TypeVar, Union

import anyio
import anyio.to_thread
from anyio import CapacityLimiter
from typing_extensions import TypeVarTuple, Unpack

if sys.version_info >= (3, 11):
from typing import TypeVarTuple, Unpack
else:
from typing_extensions import TypeVarTuple, Unpack

ANYIO_VERSION = importlib.metadata.version("anyio")

Expand Down
2 changes: 1 addition & 1 deletion asyncer/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def do_work(name: str) -> str:
async with asyncer.create_task_group() as task_group:
result1 = task_group.soonify(do_work)(name="task 1")
result2 = task_group.soonify(do_work)(name="task 2")
await anyio.sleep(0)
await anyio.lowlevel.checkpoint()
if not result1.pending:
print(result1.value)
if not result2.pending:
Expand Down
2 changes: 0 additions & 2 deletions poetry.toml

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
]
dependencies = [
"anyio >=3.4.0,<5.0",
"typing_extensions >=4.8.0; python_version < '3.10'"
"typing_extensions >=4.8.0; python_version < '3.11'"
]

[project.urls]
Expand Down
Loading