Skip to content

Commit 221ea3f

Browse files
committed
Fix typing_extensions module not found
1 parent dd9f9c5 commit 221ea3f

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ up:
2424
uv lock --upgrade
2525

2626
deps:
27-
uv sync --frozen --all-groups --extra asyncpg --extra accel --extra psycopg --extra asyncodbc --extra aiomysql $(options)
27+
uv sync --frozen --all-groups --extra sqlite --extra asyncpg --extra accel --extra psycopg --extra asyncodbc --extra aiomysql $(options)
2828

2929
deps_with_asyncmy:
30-
uv sync --frozen --all-groups --extra asyncpg --extra accel --extra psycopg --extra asyncodbc --extra asyncmy $(options)
30+
uv sync --frozen --all-groups --extra sqlite --extra asyncpg --extra accel --extra psycopg --extra asyncodbc --extra asyncmy $(options)
3131

3232
check: build _check
3333
_check:
@@ -98,8 +98,7 @@ docs: deps
9898
uv run --frozen sphinx-build -M html docs build
9999

100100
build: deps
101-
rm -fR dist/
102-
uv build
101+
uv build --clear
103102

104103
publish: deps _build
105104
uv run --frozen twine upload dist/*

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ requires-python = ">=3.9"
1010
dependencies = [
1111
"pypika-tortoise (>=0.6.3,<1.0.0)",
1212
"iso8601 (>=2.1.0,<3.0.0); python_version < '4.0'",
13-
"aiosqlite (>=0.16.0,<1.0.0)",
13+
"anyio (>=4.12.0,<5.0.0)",
14+
"typing-extensions>=4.15.0; python_version < '3.11'",
1415
"pytz",
1516
]
1617
classifiers = [
@@ -41,6 +42,7 @@ accel = [
4142
"uvloop; sys_platform != 'win32' and implementation_name == 'cpython'",
4243
"orjson",
4344
]
45+
sqlite = ["aiosqlite (>=0.22.0,<1.0.0)"]
4446
asyncpg = ["asyncpg"]
4547
aiomysql = ["aiomysql"]
4648
asyncmy = ["asyncmy (>=0.2.8,<1.0.0); python_version < '4.0'"]

tortoise/backends/sqlite/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ def __init__(self, file_path: str, **kwargs: Any) -> None:
7878

7979
async def create_connection(self, with_db: bool) -> None:
8080
if not self._connection: # pragma: no branch
81-
self._connection = aiosqlite.connect(self.filename, isolation_level=None)
82-
self._connection.start()
83-
await self._connection._connect()
81+
self._connection = await aiosqlite.connect(self.filename, isolation_level=None)
8482
self._connection._conn.row_factory = sqlite3.Row
8583
for pragma, val in self.pragmas.items():
8684
cursor = await self._connection.execute(f"PRAGMA {pragma}={val}")

tortoise/filters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import operator
4+
import sys
45
from collections.abc import Callable, Iterable, Sequence
56
from functools import partial
67
from typing import TYPE_CHECKING, Any, TypedDict
@@ -16,7 +17,11 @@
1617
Term,
1718
ValueWrapper,
1819
)
19-
from typing_extensions import NotRequired
20+
21+
if sys.version_info >= (3, 11):
22+
from typing import NotRequired
23+
else:
24+
from typing_extensions import NotRequired
2025

2126
from tortoise.contrib.postgres.fields import ArrayField
2227
from tortoise.fields import Field, JSONField

uv.lock

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

0 commit comments

Comments
 (0)