Skip to content

Commit 08c1a0a

Browse files
authored
Merge pull request #161 from psqlpy-python/f/decimal-bug
Added fallback for Decimal convertion
2 parents dfbc75f + afaa198 commit 08c1a0a

File tree

15 files changed

+116
-87
lines changed

15 files changed

+116
-87
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: PyO3/maturin-action@v1
2626
with:
2727
target: ${{ matrix.target }}
28-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10 pypy3.11
28+
args: --release --out dist -i 3.10 3.11 3.12 3.13 3.14 pypy3.10 pypy3.11
2929
sccache: 'true'
3030
manylinux: auto
3131
before-script-linux: |
@@ -71,7 +71,7 @@ jobs:
7171
uses: PyO3/maturin-action@v1
7272
with:
7373
target: ${{ matrix.target }}
74-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14
74+
args: --release --out dist -i 3.10 3.11 3.12 3.13 3.14
7575
sccache: 'true'
7676
- name: Upload wheels
7777
uses: actions/upload-artifact@v4
@@ -112,7 +112,7 @@ jobs:
112112
uses: PyO3/maturin-action@v1
113113
with:
114114
target: ${{ matrix.target }}
115-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10 pypy3.11
115+
args: --release --out dist -i 3.10 3.11 3.12 3.13 3.14 pypy3.10 pypy3.11
116116
sccache: 'true'
117117
- name: Upload wheels
118118
uses: actions/upload-artifact@v4
@@ -168,7 +168,7 @@ jobs:
168168
uses: messense/maturin-action@v1
169169
with:
170170
target: ${{ matrix.target }}
171-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 3.14 pypy3.9 pypy3.10 pypy3.11
171+
args: --release --out dist -i 3.10 3.11 3.12 3.13 3.14 pypy3.10 pypy3.11
172172
manylinux: musllinux_1_2
173173
- name: Upload wheels
174174
uses: actions/upload-artifact@v4

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
name: ${{matrix.job.os}}-${{matrix.py_version}}-${{ matrix.postgres_version }}
3636
strategy:
3737
matrix:
38-
py_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
38+
py_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3939
postgres_version: ["14", "15", "16", "17"]
4040
job:
4141
- os: ubuntu-latest

examples/aiohttp/start_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ async def start_db_pool(app: web.Application) -> None:
1818

1919
async def stop_db_pool(app: web.Application) -> None:
2020
"""Close database connection pool."""
21-
db_pool = cast(PSQLPool, app.db_pool)
21+
db_pool = cast("PSQLPool", app.db_pool)
2222
await db_pool.close()
2323

2424

2525
async def pg_pool_example(request: web.Request) -> Any:
26-
db_pool = cast(PSQLPool, request.app["db_pool"])
26+
db_pool = cast("PSQLPool", request.app["db_pool"])
2727
connection = await db_pool.connection()
2828
await asyncio.sleep(10)
2929
query_result = await connection.execute(

examples/fastapi/advanced_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Start example
22
import asyncio
3+
from collections.abc import AsyncGenerator
34
from contextlib import asynccontextmanager
4-
from typing import AsyncGenerator
55

66
import uvicorn
77
from fastapi import FastAPI

examples/fastapi/start_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Start example
2+
from collections.abc import AsyncGenerator
23
from contextlib import asynccontextmanager
3-
from typing import AsyncGenerator, cast
4+
from typing import Annotated, cast
45

56
import uvicorn
67
from fastapi import Depends, FastAPI, Request
78
from fastapi.responses import JSONResponse
89
from psqlpy import Connection, PSQLPool
9-
from typing_extensions import Annotated
1010

1111

1212
@asynccontextmanager
@@ -26,7 +26,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
2626

2727
async def db_connection(request: Request) -> Connection:
2828
"""Retrieve new connection from connection pool and return it."""
29-
return await cast(PSQLPool, request.app.state.db_pool).connection()
29+
return await cast("PSQLPool", request.app.state.db_pool).connection()
3030

3131

3232
@app.get("/")

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "psqlpy"
7-
requires-python = ">=3.8"
7+
requires-python = ">=3.10"
88
keywords = [
99
"postgresql",
1010
"psql",
@@ -27,8 +27,6 @@ classifiers = [
2727
"Programming Language :: Python",
2828
"Programming Language :: Python :: 3",
2929
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.8",
31-
"Programming Language :: Python :: 3.9",
3230
"Programming Language :: Python :: 3.10",
3331
"Programming Language :: Python :: 3.11",
3432
"Programming Language :: Python :: 3.12",

python/psqlpy/_internal/__init__.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import types
22
import typing
3+
from collections.abc import Awaitable, Callable, Mapping, Sequence
34
from enum import Enum
45
from io import BytesIO
56
from ipaddress import IPv4Address, IPv6Address
6-
from typing import Any, Awaitable, Callable, Mapping, Sequence, TypeVar
7+
from typing import Any, TypeAlias, TypeVar
78

8-
from typing_extensions import Buffer, Self, TypeAlias
9+
from typing_extensions import Buffer, Self
910

1011
_CustomClass = TypeVar(
1112
"_CustomClass",
@@ -22,7 +23,7 @@ class QueryResult:
2223
@typing.overload
2324
def result(
2425
self: Self,
25-
as_tuple: typing.Literal[None] = None,
26+
as_tuple: None = None,
2627
custom_decoders: dict[str, Callable[[bytes], Any]] | None = None,
2728
) -> list[dict[str, Any]]: ...
2829
@typing.overload
@@ -112,7 +113,7 @@ class SingleQueryResult:
112113
@typing.overload
113114
def result(
114115
self: Self,
115-
as_tuple: typing.Literal[None] = None,
116+
as_tuple: None = None,
116117
custom_decoders: dict[str, Callable[[bytes], Any]] | None = None,
117118
) -> dict[str, Any]: ...
118119
@typing.overload

python/psqlpy/_internal/extra_types.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import typing
22
from datetime import date, datetime, time, timedelta
33
from decimal import Decimal
44
from ipaddress import IPv4Address, IPv6Address
5+
from typing import TypeAlias
56
from uuid import UUID
67

7-
from typing_extensions import Self, TypeAlias
8+
from typing_extensions import Self
89

910
class SmallInt:
1011
"""Represent SmallInt in PostgreSQL and `i16` in Rust."""

python/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import random
3-
from typing import AsyncGenerator
3+
from collections.abc import AsyncGenerator
44
from urllib import parse
55

66
import pytest

python/tests/test_kwargs_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ async def test_failed_no_parameter(
7777
async with psql_pool.acquire() as conn:
7878
with pytest.raises(expected_exception=PyToRustValueMappingError):
7979
await conn.execute(
80-
querystring=(f"SELECT * FROM {table_name} " "WHERE name = $(name)p"), # noqa: ISC001
80+
querystring=(f"SELECT * FROM {table_name} WHERE name = $(name)p"),
8181
parameters={"mistake": "wow"},
8282
)

0 commit comments

Comments
 (0)