Skip to content

Commit

Permalink
feat: drop support for Python3.8 (#1848)
Browse files Browse the repository at this point in the history
* feat: drop support for Python 3.8
* Use `functools.cache` instead of lru_cache
* chore: upgrade deps
  • Loading branch information
waketzheng authored Jan 21, 2025
1 parent 71624e7 commit de48e77
Show file tree
Hide file tree
Showing 69 changed files with 1,862 additions and 1,856 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
TORTOISE_MSSQL_DRIVER: ODBC Driver 18 for SQL Server
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/cache@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install and configure Poetry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install and configure Poetry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install and configure Poetry
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Fixed
^^^^^
- Rename pypika to pypika_tortoise for fixing package name conflict (#1829)
- Concurrent connection pool initialization (#1825)

Changed
^^^^^^^
- Drop support for Python3.8 (#1848)
- Optimize field conversion to database format to speed up `create` and `bulk_create` (#1840)
- Improved query performance by optimizing SQL generation (#1837)

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can find the docs at `Documentation <https://tortoise.github.io>`_
Tortoise ORM is a young project and breaking changes are to be expected.
We keep a `Changelog <https://tortoise.github.io/CHANGELOG.html>`_ and it will have possible breakage clearly documented.

Tortoise ORM is supported on CPython >= 3.8 for SQLite, MySQL and PostgreSQL and Microsoft SQL Server and Oracle.
Tortoise ORM is supported on CPython >= 3.9 for SQLite, MySQL and PostgreSQL and Microsoft SQL Server and Oracle.

Why was Tortoise ORM built?
---------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Tortoise ORM follows a the following agreed upon style:
* Always try to separate out terms clearly rather than concatenate words directly:
* ``some_purpose`` instead of ``somepurpose``
* ``SomePurpose`` instead of ``Somepurpose``
* Keep in mind the targeted Python versions of ``>=3.8``:
* Keep in mind the targeted Python versions of ``>=3.9``:
* Do use f-strings
* Please try and provide type annotations where you can, it will improve auto-completion in editors, and better static analysis.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It's engraved in it's design that you are working not with just tables, you work

Source & issue trackers are available at `<https://github.com/tortoise/tortoise-orm/>`_

Tortoise ORM is supported on CPython >= 3.8 for SQLite, MySQL and PostgreSQL.
Tortoise ORM is supported on CPython >= 3.9 for SQLite, MySQL and PostgreSQL.

Introduction
============
Expand Down
4 changes: 2 additions & 2 deletions examples/fastapi/_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# pylint: disable=E0611,E0401
import multiprocessing
import os
from collections.abc import AsyncGenerator
from concurrent.futures import ProcessPoolExecutor
from contextlib import asynccontextmanager
from datetime import datetime
from pathlib import Path
from typing import AsyncGenerator, Tuple

import anyio
import pytest
Expand Down Expand Up @@ -74,7 +74,7 @@ async def create_user(self, async_client: AsyncClient) -> Users:
assert user_obj.id == user_id
return user_obj

async def user_list(self, async_client: AsyncClient) -> Tuple[datetime, Users, User_Pydantic]:
async def user_list(self, async_client: AsyncClient) -> tuple[datetime, Users, User_Pydantic]:
utc_now = datetime.now(pytz.utc)
user_obj = await Users.create(username="test")
response = await async_client.get("/users")
Expand Down
2 changes: 1 addition & 1 deletion examples/fastapi/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pylint: disable=E0611,E0401
import os
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from typing import AsyncGenerator

from fastapi import FastAPI
from routers import router as users_router
Expand Down
2 changes: 1 addition & 1 deletion examples/fastapi/main_custom_timezone.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pylint: disable=E0611,E0401
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from typing import AsyncGenerator

from config import register_orm
from fastapi import FastAPI
Expand Down
4 changes: 1 addition & 3 deletions examples/fastapi/routers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from typing import List

from fastapi import APIRouter, HTTPException
from models import Users
from schemas import Status, User_Pydantic, UserIn_Pydantic

router = APIRouter()


@router.get("/users", response_model=List[User_Pydantic])
@router.get("/users", response_model=list[User_Pydantic])
async def get_users():
return await User_Pydantic.from_queryset(Users.all())

Expand Down
4 changes: 2 additions & 2 deletions examples/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This example demonstrates model signals usage
"""

from typing import List, Optional, Type
from typing import Optional, Type

from tortoise import BaseDBAsyncClient, Tortoise, fields, run_async
from tortoise.models import Model
Expand Down Expand Up @@ -33,7 +33,7 @@ async def signal_post_save(
instance: Signal,
created: bool,
using_db: "Optional[BaseDBAsyncClient]",
update_fields: List[str],
update_fields: list[str],
) -> None:
print(sender, instance, using_db, created, update_fields)

Expand Down
Loading

0 comments on commit de48e77

Please sign in to comment.